/* Layout concept: one "receipt" column; each card is a shelf tag you answer on, the results screen
   prints like a grocery receipt. Rewards are stamped like store stickers. Phones get one narrow column;
   wide screens (760px+) get bigger cards with two-column reveals and receipts, and the margins left
   and right stay free for Google's side rail ads (shown from 1240px). */
:root {
  --paper: #eef1ec;        /* thermal-paper grey-green page */
  --card: #ffffff;
  --ink: #1b2330;          /* navy receipt ink */
  --muted: #5d6776;
  --line: #d3d9d1;
  --tag: #ffd23f;          /* shelf-tag yellow, the one accent */
  --tag-ink: #1b2330;
  --stamp: #3946b4;        /* date-stamp ink for years */
  --good: #23905a;
  --bad: #cf3439;
  --focus: #3946b4;
  --shadow: 0 1px 0 rgba(27, 35, 48, 0.06), 0 8px 24px -12px rgba(27, 35, 48, 0.25);

  /* Reward tiers, best to worst */
  --t-exact: #6b3fd8; --t-scanner: #23905a; --t-sharp: #1b7f9c; --t-ballpark: #a57800;
  --t-shock: #c45512; --t-off: #c62f34; --t-none: #6b7480;

  /* Illustration palette: drawn on a light sticker disc in both themes, so one set serves both */
  --i-disc: #e3eae4; --i-line: #1b2330; --i-shell: #fbf7ee; --i-carton: #b9c4cf; --i-crust: #e2a556;
  --i-tray: #c9d2dc; --i-meat: #e2707a; --i-fat: #f7cdc4; --i-sticker: #ffd23f; --i-white: #ffffff;
  --i-blue: #3b6fd6; --i-red: #d9443f; --i-dark: #2c3442; --i-roast: #d88b43; --i-shine: #f2c28c;
  --i-banana: #f2c932; --i-banana2: #f8dc5c; --i-stem: #7a5a2e; --i-bean: #6e4b33; --i-bean-dark: #573a27;
  --i-potato: #c38f55; --i-potato2: #d5a46a; --i-bacon: #d65558;
  --i-cheese: #f2b233; --i-cheese-top: #f7cd63; --i-cheese-hole: #d98f1c; --i-cheese2: #f8c64a;
  --i-pink: #f2a1b4; --i-wheat: #b97a3e; --i-sack: #ece2cc; --i-grain: #d9a441; --i-pasta: #ecc76a;
  --i-pasta-line: #c99a3a; --i-bean-red: #9b3a2f; --i-steak: #b9434b; --i-pork: #eaa49d; --i-ham: #e6858a;
  --i-ham-glaze: #b9545b; --i-lettuce: #9ccc5a; --i-lettuce-vein: #5f9a2e; --i-tomato: #e2473c;
  --i-shine-red: #f39a8f; --i-leaf: #4f9a3a; --i-lemon: #f6d33a; --i-grapefruit: #f2875c;
  --i-grapefruit-in: #f8b5a0; --i-straw: #e03b4a; --i-seed: #f8e08e; --i-orange: #f39a2b;
  --i-orange-light: #fbc77e; --i-cookie: #d8a05c; --i-cookie2: #e3b679; --i-choc: #4e321e;
  --i-chipbag: #2f7fd1; --i-chip: #f2c45a; --i-chip-line: #d19a2a; --i-sugar-shade: #e3e7ee;
  --i-sugar-side: #cfd6e1; --i-diesel: #2e9a5b; --i-diesel-dark: #1d5f39; --i-flame: #3b7be8;
  --i-flame-light: #9cc3ff; --i-barrel: #5c6c7e; --i-oil: #e3a83a;

  --f-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --f-body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "Space Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11151b; --card: #1a2029; --ink: #edf0ea; --muted: #9aa4b1; --line: #2b333f;
    --tag: #ffd23f; --tag-ink: #1b2330; --stamp: #9aa6ff; --good: #3fbf7f; --bad: #f05a5e; --focus: #9aa6ff;
    --t-exact: #b49bff; --t-scanner: #3fbf7f; --t-sharp: #4cc3e0; --t-ballpark: #e6b52a;
    --t-shock: #f08a45; --t-off: #f05a5e; --t-none: #8d96a3;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 28px -14px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #11151b; --card: #1a2029; --ink: #edf0ea; --muted: #9aa4b1; --line: #2b333f;
  --tag: #ffd23f; --tag-ink: #1b2330; --stamp: #9aa6ff; --good: #3fbf7f; --bad: #f05a5e; --focus: #9aa6ff;
  --t-exact: #b49bff; --t-scanner: #3fbf7f; --t-sharp: #4cc3e0; --t-ballpark: #e6b52a;
  --t-shock: #f08a45; --t-off: #f05a5e; --t-none: #8d96a3;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 28px -14px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}
[data-tier="exact"] { --tc: var(--t-exact); }
[data-tier="scanner"] { --tc: var(--t-scanner); }
[data-tier="sharp"] { --tc: var(--t-sharp); }
[data-tier="ballpark"] { --tc: var(--t-ballpark); }
[data-tier="shock"] { --tc: var(--t-shock); }
[data-tier="off"] { --tc: var(--t-off); }
[data-tier="none"] { --tc: var(--t-none); }


/* Content pages: price library, about and legal pages. The color, font and illustration tokens come
   first (copied from styles.css at build time), so the pages and the game share one look. */
:root { --series-1: #2a78d6; --series-2: #eb6834; }   /* chart lines: price that year / in today's dollars */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --series-1: #3987e5; --series-2: #d95926; }
}
:root[data-theme="dark"] { --series-1: #3987e5; --series-2: #d95926; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.6 var(--f-body); -webkit-font-smoothing: antialiased; }
a { color: var(--stamp); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--card); padding: 0.5rem 0.8rem; }
.skip:focus { left: 8px; top: 8px; z-index: 30; }

/* Header */
.site-head {
  max-width: 72rem; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.85rem max(16px, env(safe-area-inset-right, 0px)) 0.85rem max(16px, env(safe-area-inset-left, 0px));
}
.brand { font: 800 1.7rem/1 var(--f-display); letter-spacing: 0.01em; color: var(--ink); text-decoration: none; display: inline-flex; align-items: baseline; }
.brand .then { background: var(--tag); color: var(--tag-ink); padding: 0.05em 0.18em 0; margin-right: 0.04em; border-radius: 3px; transform: rotate(-2deg); display: inline-block; }
.site-nav { display: flex; gap: 0.2rem; align-items: center; }
.site-nav a { padding: 0.5rem 0.75rem; border-radius: 999px; text-decoration: none; color: var(--ink); font: 600 0.92rem/1 var(--f-body); }
.site-nav a[aria-current="page"] { background: var(--card); box-shadow: var(--shadow); }
.site-nav a.play { background: var(--tag); color: var(--tag-ink); }

/* Page */
.page { max-width: 46rem; margin: 0 auto; padding: 0.25rem max(16px, env(safe-area-inset-right, 0px)) 3rem max(16px, env(safe-area-inset-left, 0px)); }
.crumbs { margin: 0.5rem 0 0; font: 400 0.78rem/1.4 var(--f-mono); color: var(--muted); }
.crumbs a { color: var(--muted); }
.page-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center; }
h1 { font: 800 2.35rem/1.03 var(--f-display); margin: 0.45rem 0 0.5rem; text-wrap: balance; }
h2 { font: 800 1.65rem/1.1 var(--f-display); margin: 2.3rem 0 0.7rem; }
h3 { font: 700 1.05rem/1.3 var(--f-body); margin: 1.5rem 0 0.4rem; }
.lead { font-size: 1.1rem; line-height: 1.55; margin: 0.4rem 0 0; }
.updated { margin: 0.6rem 0 0; font: 400 0.8rem/1.4 var(--f-mono); color: var(--muted); }
.illo { width: 4.8rem; height: 4.8rem; border-radius: 50%; background: var(--i-disc); display: grid; place-items: center; flex: none; }
.illo svg { width: 82%; height: 82%; display: block; }
.illo.sm { width: 2.2rem; height: 2.2rem; }
.illo.sm svg { width: 86%; height: 86%; }
.panel { background: var(--card); border-radius: 10px; box-shadow: var(--shadow); padding: 1.1rem 1.1rem 1.25rem; }
.note { font: 400 0.8rem/1.5 var(--f-mono); color: var(--muted); }

/* Price history chart */
.chart-figure { margin: 1.5rem 0 0; }
.chart-figure figcaption { margin-top: 0.5rem; font-size: 0.85rem; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; margin: 0 0 0.5rem; padding: 0; list-style: none; font-size: 0.85rem; color: var(--muted); }
.key { display: inline-block; width: 1.1rem; border-top: 2px solid; vertical-align: middle; margin-right: 0.45rem; border-radius: 2px; }
.key.k1 { border-color: var(--series-1); }
.key.k2 { border-color: var(--series-2); }
.chart-host { position: relative; min-height: 220px; }
.chart-host svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; border-radius: 4px; }
.chart-host .grid { stroke: var(--line); stroke-width: 1; }
.chart-host .tick { font: 400 11px/1 var(--f-mono); fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart-host .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-host .line.s1 { stroke: var(--series-1); }
.chart-host .line.s2 { stroke: var(--series-2); }
.chart-host .dot { stroke: var(--card); stroke-width: 2; }
.chart-host .dot.s1 { fill: var(--series-1); }
.chart-host .dot.s2 { fill: var(--series-2); }
.chart-host .cross { stroke: var(--muted); stroke-width: 1; }
.chart-host .end-label { font: 700 12px/1 var(--f-mono); fill: var(--ink); paint-order: stroke; stroke: var(--card); stroke-width: 5px; stroke-linejoin: round; }
.tip {
  position: absolute; z-index: 2; pointer-events: none; transform: translate(-50%, -100%);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
  padding: 0.45rem 0.65rem 0.5rem; min-width: 10.5rem; font: 400 0.8rem/1.4 var(--f-body);
}
.tip-title { font: 700 0.75rem/1.3 var(--f-mono); color: var(--muted); margin-bottom: 0.15rem; }
.tip-row { display: grid; grid-template-columns: 1.1rem auto minmax(0, 1fr); gap: 0.4rem; align-items: center; white-space: nowrap; }
.tip-row b { font-variant-numeric: tabular-nums; color: var(--ink); }
.tip-row span:last-child { color: var(--muted); }
.tip-row .key { margin: 0; }

/* Then vs. now calculator */
.calc { display: grid; gap: 0.6rem; margin-top: 1.5rem; }
.calc label { font: 700 0.75rem/1 var(--f-mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.calc select {
  justify-self: start; font: 700 1.25rem/1.2 var(--f-mono); padding: 0.4rem 2rem 0.4rem 0.7rem; border: 2px solid var(--ink);
  border-radius: 8px; background: var(--paper); color: var(--ink); cursor: pointer;
}
.calc output { display: block; font-size: 1.05rem; line-height: 1.55; }

/* Facts, tables, related */
.facts { padding-left: 1.2rem; margin: 0; display: grid; gap: 0.5rem; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { padding: 0.5rem 0.65rem; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
td { font-variant-numeric: tabular-nums; }
thead th { font: 700 0.7rem/1.2 var(--f-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); vertical-align: bottom; }
tr.partial td { color: var(--muted); }
tr.partial td small { display: block; font-size: 0.75rem; }
td.gap { text-align: left; white-space: normal; font-size: 0.85rem; }
thead th { white-space: normal; }
@media (max-width: 599px) {
  th, td { padding: 0.5rem 0.4rem; }
  table { font-size: 0.9rem; }
}
.na { color: var(--muted); }
.item-cell { display: flex; align-items: center; gap: 0.6rem; white-space: normal; }
.m-only { display: none; }
/* Phones: each item of the price index becomes a compact row (name and price on top, the two changes below) */
@media (max-width: 599px) {
  .index-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .index-table, .index-table tbody { display: block; }
  .index-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.2rem 0.75rem; padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
  .index-table td { display: block; border: 0; padding: 0; white-space: normal; }
  .index-table td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .index-table td:nth-child(2) { grid-column: 2; grid-row: 1; text-align: right; font-weight: 700; }
  .index-table td:nth-child(3), .index-table td:nth-child(4) { grid-column: 1 / -1; text-align: left; padding-left: 2.8rem; font-size: 0.85rem; color: var(--muted); }
  .index-table td br { display: none; }
  .index-table td small.na { margin-left: 0.3rem; }
  .m-only { display: inline; }
}
.item-cell a { font-weight: 600; }
.item-cell small { display: block; color: var(--muted); font-size: 0.78rem; }
.related { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.6rem; }
.related a {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.6rem; align-items: center; padding: 0.55rem 0.75rem;
  background: var(--card); border-radius: 10px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); font-weight: 600;
}
.related .price { font: 700 0.85rem/1 var(--f-mono); color: var(--muted); }
.cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.9rem; margin-top: 2.4rem;
  background: var(--ink); color: var(--paper); border-radius: 12px; padding: 1.15rem 1.25rem;
}
.cta p { margin: 0; font: 800 1.45rem/1.15 var(--f-display); }
.cta a { background: var(--tag); color: var(--tag-ink); text-decoration: none; font: 700 1rem/1 var(--f-body); padding: 0.85rem 1.15rem; border-radius: 8px; }
.aisle-nav { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1.2rem 0 0; padding: 0; list-style: none; }
.aisle-nav a { display: inline-block; padding: 0.4rem 0.75rem; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); font: 600 0.88rem/1 var(--f-body); }

/* Prose pages */
.prose p, .prose li { max-width: 42rem; }
.prose ul { padding-left: 1.2rem; }
.draft-note { margin: 1rem 0 0; border-left: 3px solid var(--tag); padding-left: 0.7rem; font: 400 0.85rem/1.5 var(--f-mono); color: var(--muted); }

/* Ads: labelled, away from buttons; prototype placeholders */
.ad-slot { margin: 2rem 0; padding: 0.55rem 0.6rem 0.7rem; border: 1px solid var(--line); border-radius: 8px; min-height: 120px; display: flex; flex-direction: column; gap: 0.4rem; }
.ad-label { margin: 0; font: 400 0.62rem/1 var(--f-mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.ad-slot.placeholder { background: repeating-linear-gradient(135deg, transparent 0 10px, color-mix(in srgb, var(--line) 40%, transparent) 10px 20px); }
.ad-slot.placeholder p:last-child { margin: auto; max-width: 16rem; font: 400 0.75rem/1.4 var(--f-mono); color: var(--muted); text-align: center; }
.sim-rail { display: none; }
.sim-anchor {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; justify-content: center; align-items: center;
  padding: 6px 3rem calc(6px + env(safe-area-inset-bottom, 0px)); background: var(--card);
  border-top: 1px solid var(--line); box-shadow: 0 -8px 20px -14px rgba(0, 0, 0, 0.45);
}
.sim-anchor-ad, .sim-rail {
  border: 1px dashed var(--muted); border-radius: 4px; flex-direction: column; justify-content: center; align-items: center; gap: 0.3rem;
  text-align: center; padding: 0.4rem;
  background: repeating-linear-gradient(135deg, var(--card) 0 10px, color-mix(in srgb, var(--line) 45%, var(--card)) 10px 20px);
}
.sim-anchor-ad { display: flex; width: 320px; max-width: 100%; height: 50px; }
.sim-text { margin: 0; font: 400 0.68rem/1.3 var(--f-mono); color: var(--muted); }
.sim-close {
  position: absolute; right: 0.6rem; top: 50%; transform: translateY(-50%); width: 2rem; height: 2rem; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; font: 400 1.1rem/1 var(--f-body);
}
body.has-anchor { padding-bottom: 72px; }

/* Footer */
.site-foot {
  max-width: 46rem; margin: 0 auto; display: grid; gap: 0.6rem; border-top: 1px solid var(--line);
  padding: 1.4rem max(16px, env(safe-area-inset-right, 0px)) 2.5rem max(16px, env(safe-area-inset-left, 0px));
  font: 400 0.78rem/1.6 var(--f-mono); color: var(--muted);
}
.site-foot nav { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; }
.site-foot a { color: var(--muted); }
.site-foot p { margin: 0; }

@media (hover: hover) {
  .site-nav a:hover:not(.play) { background: color-mix(in srgb, var(--card) 70%, transparent); }
  .related a:hover, .aisle-nav a:hover { box-shadow: 0 0 0 2px var(--line), var(--shadow); }
  .cta a:hover { filter: brightness(1.06); }
}
@media (min-width: 760px) {
  h1 { font-size: 3.1rem; }
  .illo { width: 6.5rem; height: 6.5rem; }
  .lead { font-size: 1.2rem; }
  .panel { padding: 1.4rem 1.5rem 1.5rem; }
  .sim-anchor-ad { width: 728px; height: 90px; }
  body.has-anchor { padding-bottom: 112px; }
}
@media (min-width: 1240px) {
  .sim-rail { display: flex; position: fixed; z-index: 5; top: 88px; width: 160px; height: min(600px, calc(100vh - 88px - 124px)); }
  .sim-rail.left { left: 12px; }
  .sim-rail.right { right: 12px; }
}
@media (min-width: 1560px) { .sim-rail { width: 300px; } }
@media (max-width: 380px) {
  .site-nav a { padding: 0.45rem 0.55rem; font-size: 0.86rem; }
  .brand { font-size: 1.5rem; }
}
