/* Agriva pitch — Moorline Miniature structure in Agriva colours.
   World tokens are read by world.js, so the scene and the interface never disagree. */
:root {
  color-scheme: light;
  /* world */
  --sky: #e8ebe3;
  --ground: #f0ede3;
  --desert: #e9e4d5;
  --rock: #d4cbb6;
  --pave: #d8d5ca;
  --paint: #fbfaf5;
  --build: #f8f6ef;
  --build-2: #d2d1c6;
  --steel: #8b938d;
  --glass: #26302a;
  --green: #9ec59d;
  --vine: #7aa86b;
  --cactus: #93ab88;
  --grass: #d5e3c6;
  --trunk: #b2a38e;
  --water: #a9cfd6;
  --cargo: #d8c29b;
  --accent: #c9de3c;
  --data: #2f6b45;
  --signal-red: #cf4a2f;
  --signal-green: #2a9a5c;
  --grape: #6e3a62;
  --grower-a: #2f7a4c;
  --grower-c: #86b85c;
  --short: #d08a2a;
  /* interface */
  --ink: #16251c;
  --muted: #536058;
  --card: rgba(250, 248, 242, 0.9);
  --line: rgba(22, 37, 28, 0.14);
  --on-accent: #173c2a;
  --focus: #2f6b45;
  --brand-ink: #173c2a;
  --brand-dot: #92b83e;
  --danger: #a23e2b;
  --pass: #236f48;
  --pass-soft: rgba(35, 111, 72, 0.12);
  --offer-soft: rgba(35, 111, 72, 0.3);
  --warn: #9a5f12;
  --warn-soft: rgba(176, 115, 26, 0.14);
  --fail-soft: rgba(162, 62, 43, 0.12);
  --scr-bg: #f6f1e7;
  --scr-card: #fffdf8;
  --scr-line: rgba(22, 37, 28, 0.12);
  --scr-soft: #ece5d5;
  --scr-btn: #173c2a;
  --scr-btn-ink: #f6f1e7;
  --pill: #dceb6a;
  --pill-ink: #173c2a;
  --r-grower: #1e6b4f;
  --r-shipper: #8a6522;
  --r-buyer: #2a5c93;
  --r-retail: #7b4f86;
  --r-people: #5d6662;
  --r-border: #56616a;
  --chat-me: #dff0c8;
  --chat-bot: #fffdf8;

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow-card: 0 18px 40px -24px rgba(0, 0, 0, 0.35);
  --blur: 14px;
  --header: 76px;
  --bar: 76px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --sky: #0b120e; --ground: #1b2520; --desert: #2b271f; --rock: #3a3427; --pave: #29322d; --paint: #5d6962;
    --build: #34403a; --build-2: #26302b; --steel: #5f6a63; --glass: #090e0b; --green: #33603f; --vine: #3b6e42;
    --cactus: #3a5a3d; --grass: #1a2a20; --trunk: #3a332b; --water: #0d2230; --cargo: #5e503b; --accent: #dceb6a;
    --data: #dceb6a; --signal-red: #ff5a47; --signal-green: #2fd182;
    --grape: #9a5a8c; --grower-a: #4fb57a; --grower-c: #a6d878; --short: #f2a640;
    --ink: #edf1ec; --muted: #a2aca5; --card: rgba(13, 19, 15, 0.86); --line: rgba(237, 241, 236, 0.15);
    --focus: #dceb6a; --brand-ink: #edf1ec; --brand-dot: #dceb6a; --danger: #ff8f80;
    --pass: #6fd39a; --pass-soft: rgba(111, 211, 154, 0.14); --offer-soft: rgba(111, 211, 154, 0.32);
    --warn: #f2b65a; --warn-soft: rgba(242, 182, 90, 0.14); --fail-soft: rgba(255, 143, 128, 0.14);
    --scr-bg: #101813; --scr-card: #17211b; --scr-line: rgba(237, 241, 236, 0.12); --scr-soft: #213027;
    --scr-btn: #dceb6a; --scr-btn-ink: #173c2a; --pill: #dceb6a; --pill-ink: #173c2a;
    --r-grower: #3fae7f; --r-shipper: #c99a45; --r-buyer: #5b93d6; --r-retail: #b483c2; --r-people: #8e9893; --r-border: #8d99a3;
    --chat-me: #26401f; --chat-bot: #17211b;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --sky: #0b120e; --ground: #1b2520; --desert: #2b271f; --rock: #3a3427; --pave: #29322d; --paint: #5d6962;
  --build: #34403a; --build-2: #26302b; --steel: #5f6a63; --glass: #090e0b; --green: #33603f; --vine: #3b6e42;
  --cactus: #3a5a3d; --grass: #1a2a20; --trunk: #3a332b; --water: #0d2230; --cargo: #5e503b; --accent: #dceb6a;
  --data: #dceb6a; --signal-red: #ff5a47; --signal-green: #2fd182;
  --grape: #9a5a8c; --grower-a: #4fb57a; --grower-c: #a6d878; --short: #f2a640;
  --ink: #edf1ec; --muted: #a2aca5; --card: rgba(13, 19, 15, 0.86); --line: rgba(237, 241, 236, 0.15);
  --focus: #dceb6a; --brand-ink: #edf1ec; --brand-dot: #dceb6a; --danger: #ff8f80;
  --pass: #6fd39a; --pass-soft: rgba(111, 211, 154, 0.14); --offer-soft: rgba(111, 211, 154, 0.32);
  --warn: #f2b65a; --warn-soft: rgba(242, 182, 90, 0.14); --fail-soft: rgba(255, 143, 128, 0.14);
  --scr-bg: #101813; --scr-card: #17211b; --scr-line: rgba(237, 241, 236, 0.12); --scr-soft: #213027;
  --scr-btn: #dceb6a; --scr-btn-ink: #173c2a; --pill: #dceb6a; --pill-ink: #173c2a;
  --r-grower: #3fae7f; --r-shipper: #c99a45; --r-buyer: #5b93d6; --r-retail: #b483c2; --r-people: #8e9893; --r-border: #8d99a3;
  --chat-me: #26401f; --chat-bot: #17211b;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--sky);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button { font: inherit; color: inherit; }

#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; touch-action: pan-y; }
.no-webgl body { background: linear-gradient(180deg, var(--sky), var(--grass)); }
.no-webgl #world { display: none; }

/* ---------- header ---------- */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; gap: 14px;
  padding: max(14px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 18px max(24px, env(safe-area-inset-left));
  background: linear-gradient(to bottom, color-mix(in srgb, var(--sky) 92%, transparent) 45%, color-mix(in srgb, var(--sky) 0%, transparent));
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.brand { display: inline-flex; color: var(--brand-ink); }
.brand svg { width: 104px; height: 27px; fill: var(--brand-ink); }
.brand svg .dot { fill: var(--brand-dot); }
.tag {
  font: 500 11.5px/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  padding-left: 14px; border-left: 1px solid var(--line); white-space: nowrap;
}
.tools { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.lang {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.lang button {
  font: 500 11.5px/1 var(--font-mono); letter-spacing: 0.06em;
  padding: 7px 10px; border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: pointer;
}
.lang button:hover { color: var(--ink); }
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--sky); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 14px/1 var(--font-body);
  padding: 12px 16px; border-radius: 4px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-accent:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.cta .short { display: none; }

/* day / night switch (from Moorline Miniature) */
.mode {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 5px 12px 5px 5px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; color: var(--ink);
  font: 500 11.5px/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.mode:hover { border-color: var(--ink); }
.mode-track { position: relative; flex: none; width: 46px; height: 26px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 10%, transparent); }
.mode-knob {
  position: absolute; top: 3px; left: 3px; display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%; background: var(--accent);
  transition: transform 0.35s cubic-bezier(0.3, 0.7, 0.2, 1);
}
.mode-knob svg { grid-area: 1 / 1; width: 12px; height: 12px; fill: none; stroke: var(--on-accent); stroke-width: 2; stroke-linecap: round; transition: opacity 0.25s; }
.mode .moon { opacity: 0; }
.mode[aria-checked="true"] .mode-knob { transform: translateX(20px); }
.mode[aria-checked="true"] .sun { opacity: 0; }
.mode[aria-checked="true"] .moon { opacity: 1; }
.mode-label { min-width: 4ch; }

/* ---------- stage: chapter card on the left, product screen on the right ---------- */
.stage {
  position: fixed; z-index: 3;
  top: var(--header); bottom: var(--bar); left: 0; right: 0;
  display: grid;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr) minmax(360px, 470px);
  align-items: start;
  padding: 8px max(24px, env(safe-area-inset-right)) 8px max(24px, env(safe-area-inset-left));
  pointer-events: none;
}
.stage > * { pointer-events: auto; }
.card {
  grid-column: 1;
  display: grid; gap: 14px;
  padding: 22px 24px 20px;
  background: var(--card);
  border: 1px solid var(--line); border-radius: 6px;
  backdrop-filter: blur(var(--blur)) saturate(1.15); -webkit-backdrop-filter: blur(var(--blur)) saturate(1.15);
  box-shadow: var(--shadow-card);
  max-height: 100%; overflow: auto;
}
.eyebrow {
  display: flex; align-items: center; gap: 10px; margin: 0;
  font: 500 12px/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.eyebrow::before { content: ""; width: 8px; height: 8px; background: var(--accent); flex: none; box-shadow: 0 0 0 1px color-mix(in srgb, var(--on-accent) 25%, transparent); }
.eyebrow b { color: var(--ink); font-weight: 500; }
.card h1 {
  margin: 0; font: 600 clamp(23px, 2.2vw, 31px)/1.14 var(--font-body); letter-spacing: -0.02em; text-wrap: balance;
}
.card h1 em { font-family: var(--font-serif); font-weight: 400; font-style: italic; letter-spacing: -0.01em; }
.card .lead { margin: 0; color: var(--muted); max-width: 44ch; }
.facts {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  margin: 2px 0 0; padding-top: 14px; border-top: 1px solid var(--line);
}
.facts:empty { display: none; }
.facts div { display: grid; gap: 5px; align-content: start; min-width: 0; }
.facts dt { font: 500 18px/1.1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.facts dd { margin: 0; font-size: 12.5px; line-height: 1.35; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions:empty { display: none; }
.card .note { margin: 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.45; color: var(--muted); }
.card.swap > * { animation: card-in 0.45s cubic-bezier(0.2, 0, 0, 1) both; }
.card.swap > :nth-child(2) { animation-delay: 0.04s; }
.card.swap > :nth-child(3) { animation-delay: 0.08s; }
.card.swap > :nth-child(4) { animation-delay: 0.12s; }
@keyframes card-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- product screen ---------- */
.screen {
  grid-column: 3; align-self: center;
  display: flex; flex-direction: column;
  max-height: 100%; min-height: 0;
  background: var(--scr-bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.win-bar {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 9px 12px; border-bottom: 1px solid var(--scr-line);
  background: var(--scr-card);
  font: 500 11px/1 var(--font-mono); letter-spacing: 0.02em;
}
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--ink) 16%, transparent); }
.who { display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 4px 8px 4px 6px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 6%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who i { width: 8px; height: 8px; border-radius: 50%; background: var(--role, var(--ink)); flex: none; }
.url { margin-left: auto; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.win-body { padding: 16px 18px 18px; overflow: auto; min-height: 0; font-size: 13.5px; line-height: 1.45; }
.screen.swap .win-body > * { animation: card-in 0.4s cubic-bezier(0.2, 0, 0, 1) both; }

.s-h { margin: 0 0 4px; font: 600 19px/1.2 var(--font-body); letter-spacing: -0.015em; }
.s-h em { font-family: var(--font-serif); font-weight: 400; font-style: italic; }
.s-sub { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; }
.s-k { font: 500 10.5px/1.2 var(--font-mono); letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.s-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.s-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.s-q { margin: 14px 0 0; font-weight: 600; }

.sbtn {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 13px/1 var(--font-body); padding: 10px 15px;
  border-radius: 999px; border: 1px solid transparent;
  background: var(--scr-btn); color: var(--scr-btn-ink); cursor: default; text-decoration: none; white-space: nowrap;
  position: relative;
}
a.sbtn, button.sbtn[data-restart] { cursor: pointer; }
.sbtn.ghost { background: transparent; color: var(--ink); border-color: var(--scr-line); }
.sbtn.pr.on { animation: press 0.5s ease-out; }
.sbtn.pr.on::after {
  content: ""; position: absolute; inset: -4px; border-radius: 999px; border: 2px solid var(--accent);
  animation: ring 0.9s ease-out forwards;
}
@keyframes press { 0% { transform: scale(1); } 30% { transform: scale(0.94); } 100% { transform: scale(1); } }
@keyframes ring { from { opacity: 1; transform: scale(0.96); } to { opacity: 0; transform: scale(1.18); } }

.toast {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 11px; border-radius: 6px; background: var(--pass-soft); color: var(--pass);
  font: 500 12px/1.3 var(--font-body);
}
.toast::before { content: "✓"; font-weight: 700; }

.pill {
  display: inline-block; padding: 4px 8px; border-radius: 999px;
  font: 600 10px/1 var(--font-mono); letter-spacing: 0.07em; text-transform: uppercase; white-space: nowrap;
  background: var(--pill); color: var(--pill-ink);
}
.pill.soft { background: var(--pass-soft); color: var(--pass); }
.pill.fail { background: var(--fail-soft); color: var(--danger); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.grey { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--muted); }

/* reveal on the screen's own clock */
.rv { opacity: 0; transform: translateY(6px); transition: opacity 0.35s ease, transform 0.35s ease; }
.rv.on { opacity: 1; transform: none; }

/* form */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.form label { display: grid; gap: 5px; min-width: 0; font: 500 10.5px/1.2 var(--font-mono); letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.form .wide { grid-column: 1 / -1; }
.inp {
  display: flex; align-items: center; min-height: 34px; padding: 7px 10px;
  background: var(--scr-card); border: 1px solid var(--scr-line); border-radius: 6px;
  font: 400 13.5px/1.2 var(--font-body); letter-spacing: 0; text-transform: none; color: var(--ink);
  white-space: nowrap; overflow: hidden;
}
.inp.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.typed.typing::after { content: ""; display: inline-block; width: 1.5px; height: 1em; margin-left: 1px; vertical-align: -2px; background: var(--ink); animation: caret 0.8s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font: 500 10.5px/1.2 var(--font-mono); letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.chk { padding: 5px 9px; border-radius: 999px; border: 1px solid var(--scr-line); font: 500 12px/1 var(--font-body); letter-spacing: 0; text-transform: none; color: var(--muted); }
.chk.yes { background: var(--pass-soft); border-color: transparent; color: var(--pass); }

/* weeks strip */
.weeks { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; margin: 4px 0 0; }
.wk { display: grid; gap: 4px; justify-items: center; font: 500 9.5px/1 var(--font-mono); color: var(--muted); }
.wk .col { width: 100%; height: 54px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 7%, transparent); position: relative; overflow: hidden; display: flex; flex-direction: column-reverse; }
.wk .col i { display: block; width: 100%; transition: height 0.6s cubic-bezier(0.2, 0, 0, 1); height: 0; }
.wk .col i.a { background: var(--offer-soft); }
.wk .col i.c { background: color-mix(in srgb, var(--pass) 18%, transparent); }
.wk .col.signed i.a { background: var(--pass); }
.wk .col.signed i.c { background: color-mix(in srgb, var(--pass) 62%, var(--scr-card)); }
.wk.on .col i.a { height: 30%; }
.wk.on .col i.c { height: 70%; }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0 0; }
.kpis div { background: var(--scr-card); border: 1px solid var(--scr-line); border-radius: 8px; padding: 9px 10px; display: grid; gap: 4px; }
.kpis b { font: 500 17px/1 var(--font-mono); font-variant-numeric: tabular-nums; }

/* checks */
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.checks li { display: grid; grid-template-columns: 20px 1fr; column-gap: 9px; align-items: start; padding: 8px 10px; background: var(--scr-card); border: 1px solid var(--scr-line); border-radius: 8px; }
.checks li small { grid-column: 2; color: var(--muted); font-size: 12px; }
.tick { grid-row: span 2; width: 18px; height: 18px; border-radius: 50%; background: var(--pass); position: relative; margin-top: 1px; }
.tick::after { content: ""; position: absolute; left: 6px; top: 3px; width: 4px; height: 8px; border: solid var(--scr-card); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.agent { display: inline-flex; align-items: center; gap: 6px; font: 500 11px/1 var(--font-mono); color: var(--muted); }
.agent::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

/* offer */
.price { display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 12px; padding: 12px 14px; background: var(--scr-card); border: 1px solid var(--scr-line); border-radius: 8px; margin-bottom: 12px; }
.price .s-k { grid-column: 1 / -1; margin-bottom: 4px; }
.price b { font: 500 28px/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.price span { color: var(--muted); font-size: 12px; }
.range { display: block; height: 6px; margin-top: 8px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 9%, transparent); overflow: hidden; }
.range i { display: block; height: 100%; width: 0; background: var(--pass); transition: width 1.1s cubic-bezier(0.2, 0, 0, 1); }
.range i.on { width: 100%; }
.slider { display: grid; gap: 6px; font: 500 10.5px/1.2 var(--font-mono); letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.others { margin-top: 12px; font-size: 12px; color: var(--muted); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; font: 500 10px/1.2 var(--font-mono); letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); padding: 0 6px 7px; border-bottom: 1px solid var(--scr-line); }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--scr-line); vertical-align: top; }
.tbl td small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.tbl .n { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.tbl th.n { text-align: right; }
.tbl tr.tot td { font-weight: 600; border-bottom: 0; }
.tbl tr.rv { transform: none; }
.ok { color: var(--pass); }
.bad { color: var(--warn); }
.sum { margin-top: 12px; padding: 9px 12px; border-radius: 8px; background: var(--pass-soft); color: var(--pass); font-weight: 600; font-size: 13px; }

/* coverage */
.cov { display: flex; height: 30px; border-radius: 6px; overflow: hidden; background: color-mix(in srgb, var(--ink) 7%, transparent); }
.cov i { display: flex; align-items: center; padding: 0 10px; font: 600 11.5px/1 var(--font-mono); font-style: normal; color: var(--pass); white-space: nowrap; width: 0; overflow: hidden; transition: width 0.9s cubic-bezier(0.2, 0, 0, 1), background 0.4s; background: var(--offer-soft); }
.cov i + i { border-left: 2px solid var(--scr-bg); }
.cov i.on.a { width: 30%; }
.cov i.on.c { width: 70%; }
.legend { margin: 8px 0 12px; font-size: 11.5px; color: var(--muted); }
.ribbon { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; margin-top: 12px; }
.ribbon span { display: grid; gap: 5px; font: 500 9.5px/1.2 var(--font-mono); letter-spacing: 0.03em; color: var(--muted); }
.ribbon span::before { content: ""; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 10%, transparent); }
.ribbon span.done::before { background: var(--pass); }
.ribbon span.now { color: var(--ink); }
.ribbon span.now::before { background: var(--accent); }

/* contract */
.terms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin: 0 0 12px; }
.terms div { display: grid; gap: 3px; min-width: 0; }
.terms dt { font: 500 10px/1.2 var(--font-mono); letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.terms dd { margin: 0; font-size: 13px; }
.sign { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 1px dashed var(--scr-line); border-radius: 8px; background: var(--scr-card); }
.sign span { font-size: 11.5px; color: var(--muted); }
.sig { width: 160px; height: 38px; flex: none; }
.sig path { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 420; stroke-dashoffset: 420; }
.sig path.on { transition: stroke-dashoffset 1.1s ease-in-out; stroke-dashoffset: 0; }
.line-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 9px 12px; border-radius: 8px; background: var(--scr-card); border: 1px solid var(--scr-line); font-size: 12.5px; }

/* shipment track */
.track { list-style: none; margin: 0; padding: 0 0 0 4px; display: grid; gap: 0; }
.track li { position: relative; padding: 0 0 12px 22px; color: var(--muted); }
.track li::before { content: ""; position: absolute; left: 0; top: 4px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--ink) 25%, transparent); background: var(--scr-bg); transition: background 0.3s, border-color 0.3s; }
.track li::after { content: ""; position: absolute; left: 5px; top: 16px; bottom: 0; width: 2px; background: color-mix(in srgb, var(--ink) 12%, transparent); }
.track li:last-child::after { display: none; }
.track li b { display: block; font-weight: 500; color: var(--muted); transition: color 0.3s; }
.track li small { font: 400 11px/1.3 var(--font-mono); }
.track li.on b { color: var(--ink); }
.track li.on::before { background: var(--pass); border-color: var(--pass); }
.track li.warn.on b { color: var(--warn); }
.track li.warn.on::before { background: var(--warn); border-color: var(--warn); }
.track li.cur::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.clock { display: flex; gap: 8px; margin-top: 4px; }
.clock div { flex: 1; background: var(--scr-card); border: 1px solid var(--scr-line); border-radius: 8px; padding: 8px 10px; display: grid; gap: 3px; }
.clock b { font: 500 15px/1 var(--font-mono); font-variant-numeric: tabular-nums; }

/* plan vs fact chart */
.chart { width: 100%; height: auto; display: block; margin: 2px 0 10px; overflow: visible; }
.chart .plan { fill: none; stroke: color-mix(in srgb, var(--ink) 30%, transparent); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .fa { fill: var(--pass); }
.chart .fc { fill: color-mix(in srgb, var(--pass) 45%, var(--scr-bg)); }
.chart .short { fill: var(--warn); }
.chart .bar { transform-box: fill-box; transform-origin: bottom; transform: scaleY(0); transition: transform 0.7s cubic-bezier(0.2, 0, 0, 1); }
.chart .bar.on { transform: scaleY(1); }
.chart text { font: 500 9px var(--font-mono); fill: var(--muted); }
.chart .warn-dot { fill: var(--warn); opacity: 0; transition: opacity 0.3s; }
.chart .warn-dot.on { opacity: 1; }
.chart .axis { stroke: var(--scr-line); }
.flag { margin: 10px 0 0; padding: 8px 11px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 12px; }
.key { display: flex; gap: 12px; font-size: 11px; color: var(--muted); margin: -4px 0 6px; }
.key i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* chat */
.chat-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--scr-line); }
.chat-head .av { width: 30px; height: 30px; border-radius: 50%; background: var(--scr-btn); color: var(--scr-btn-ink); display: grid; place-items: center; font: 600 12px/1 var(--font-body); }
.chat-head b { display: block; font-size: 13px; }
.chat-head small { color: var(--muted); font-size: 11.5px; }
.chat { display: grid; gap: 8px; }
.msg { max-width: 88%; padding: 8px 11px; border-radius: 12px; font-size: 13px; line-height: 1.45; background: var(--chat-bot); border: 1px solid var(--scr-line); }
.msg b { display: block; font-size: 11px; margin-bottom: 2px; color: var(--muted); font-weight: 600; }
.msg.me { justify-self: end; background: var(--chat-me); border-color: transparent; border-bottom-right-radius: 4px; }
.msg.bot { border-bottom-left-radius: 4px; }
.msg.sys { justify-self: center; max-width: 100%; background: transparent; border: 0; font: 500 11px/1.3 var(--font-mono); color: var(--muted); padding: 2px; }
.voice { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.voice .pl { width: 22px; height: 22px; border-radius: 50%; background: var(--pass); position: relative; flex: none; }
.voice .pl::after { content: ""; position: absolute; left: 8px; top: 6px; border: solid transparent; border-width: 5px 0 5px 8px; border-left-color: var(--scr-card); }
.voice .wave { display: flex; align-items: center; gap: 2px; height: 18px; }
.voice .wave i { width: 2px; border-radius: 1px; background: var(--pass); opacity: 0.7; }
.voice small { font: 500 10.5px/1 var(--font-mono); color: var(--muted); }
.typing-dots { display: inline-flex; gap: 4px; padding: 3px 0; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1s ease-in-out infinite; }
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
.msg.gone { display: none; }
.chat .acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* chain + system blocks */
.chain { display: grid; gap: 6px; }
.tier { display: grid; grid-template-columns: 52px 1fr; align-items: center; column-gap: 12px; padding: 10px 12px; background: var(--scr-card); border: 1px solid var(--scr-line); border-radius: 8px; }
.tier .n { grid-row: span 2; font: 500 13px/1 var(--font-mono); padding: 6px 0; text-align: center; border-radius: 6px; background: color-mix(in srgb, var(--ink) 7%, transparent); }
.tier span { font-weight: 600; }
.tier small { color: var(--muted); font-size: 11.5px; }
.tier.hi { border-color: var(--pass); box-shadow: inset 3px 0 0 var(--accent); }
.tier.hi .n { background: var(--pill); color: var(--pill-ink); }
.chain .arrow { text-align: center; color: var(--muted); font-size: 12px; line-height: 1; }
.callout { margin-top: 10px; padding: 9px 12px; border-radius: 8px; background: var(--pill); color: var(--pill-ink); font-size: 12.5px; font-weight: 500; }
.blocks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.blk { display: grid; gap: 4px; align-content: start; padding: 11px 12px; background: var(--scr-card); border: 1px solid var(--scr-line); border-radius: 8px; }
.blk b { font-size: 13px; }
.blk span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.blk.hi { box-shadow: inset 3px 0 0 var(--accent); }

/* ---------- labels over the world ---------- */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.lbl {
  position: absolute; left: 0; top: 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 4px;
  font: 500 11.5px/1 var(--font-mono); color: var(--ink); white-space: nowrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 4px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.35s;
  will-change: transform;
}
.lbl::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: 9px; background: color-mix(in srgb, var(--ink) 35%, transparent); }
.lbl b { min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center; border-radius: 3px; background: var(--role, var(--ink)); color: #fff; font-size: 10.5px; font-weight: 600; }
.lbl.agriva b { background: var(--accent); color: var(--on-accent); }
.lbl.dim { opacity: 0.5; }
.lbl.off { opacity: 0; }
.lbl.focus { border-color: color-mix(in srgb, var(--ink) 40%, transparent); }

/* ---------- player ---------- */
.player {
  position: fixed; z-index: 5; left: 50%; transform: translateX(-50%);
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 4px;
  max-width: calc(100% - 24px);
  padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow-card);
}
.pbtn { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 5px; background: none; color: var(--ink); cursor: pointer; }
.pbtn:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.pbtn:disabled { opacity: 0.35; cursor: default; background: none; }
.pbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pbtn.play { background: var(--accent); color: var(--on-accent); }
.pbtn.play svg { fill: currentColor; stroke: none; }
.pbtn.play .i-pause { display: none; }
.player.playing .pbtn.play .i-play { display: none; }
.player.playing .pbtn.play .i-pause { display: block; }
.segs { display: flex; gap: 3px; list-style: none; margin: 0 6px; padding: 0; min-width: 0; }
.segs button { width: 30px; height: 32px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; align-items: center; }
.segs button i { display: block; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 16%, transparent); position: relative; overflow: hidden; }
.segs button i::after { content: ""; position: absolute; inset: 0; background: var(--ink); transform-origin: left center; transform: scaleX(var(--p, 0)); }
.segs button.done i::after { transform: scaleX(1); opacity: 0.55; }
.segs button[aria-current="step"] i { height: 6px; }
.segs button[aria-current="step"] i::after { background: var(--pass); }
.segs button:hover i { background: color-mix(in srgb, var(--ink) 30%, transparent); }
.count { flex: none; font: 500 12px/1 var(--font-mono); color: var(--muted); padding: 0 10px 0 4px; font-variant-numeric: tabular-nums; }

/* loading chip */
.status {
  position: fixed; z-index: 6; right: max(24px, env(safe-area-inset-right)); bottom: calc(var(--bar) + 14px);
  margin: 0; padding: 8px 12px;
  font: 500 12px/1.3 var(--font-mono); color: var(--muted);
  background: var(--card); border: 1px solid var(--line); border-radius: 3px;
  transition: opacity 0.6s;
}
html.world-ready .status { opacity: 0; pointer-events: none; }
.noscript { position: fixed; inset: 40% 20px auto; text-align: center; }

/* ---------- narrower screens ---------- */
@media (max-width: 1240px) {
  .stage { grid-template-columns: minmax(280px, 360px) minmax(0, 1fr) minmax(340px, 420px); }
  .tag { display: none; }
}
@media (max-width: 1000px) {
  :root { --bar: 66px; }
  body { font-size: 14px; }
  .stage {
    top: auto; bottom: calc(var(--bar) + 4px);
    display: block;
    height: 50dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 0 max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left));
    overscroll-behavior: contain;
  }
  .card { padding: 16px 16px 14px; gap: 10px; max-height: none; overflow: visible; }
  .card h1 { font-size: 21px; }
  .card .lead { font-size: 13.5px; line-height: 1.5; }
  .facts { gap: 8px; padding-top: 10px; }
  .facts dt { font-size: 15px; }
  .facts dd { font-size: 11.5px; }
  .screen { margin-top: 8px; max-height: none; }
  .win-body { font-size: 12.5px; padding: 12px 13px 14px; }
  .url { display: none; }
  .who { margin-right: auto; }
  .status { bottom: auto; top: 64px; right: 12px; }
}
@media (max-width: 640px) {
  .top { padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 14px max(12px, env(safe-area-inset-left)); gap: 8px; }
  .brand svg { width: 84px; height: 22px; }
  .tools { gap: 6px; }
  .mode { padding-right: 5px; }
  .mode-label { display: none; }
  .cta { padding: 10px 11px; font-size: 13px; }
  .cta .long { display: none; }
  .cta .short { display: inline; }
  .lang button { padding: 6px 8px; }
  .segs { margin: 0 2px; gap: 2px; }
  .segs button { width: 16px; }
  .pbtn { width: 34px; height: 34px; }
  .count { display: none; }
  .segs { margin-right: 6px; }
  .form { grid-template-columns: 1fr 1fr; gap: 8px; }
  .lbl { font-size: 10.5px; }
  .lbl.dim { opacity: 0; }
  .weeks .wk span { display: none; }
  .tbl { font-size: 11.5px; }
  .blocks { grid-template-columns: 1fr; }
}
@media (max-width: 350px) {
  .mode { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mode-knob, .mode-knob svg, .rv, .wk .col i, .range i, .cov i, .chart .bar, .sig path.on { transition: none; }
  .card.swap > *, .screen.swap .win-body > *, .sbtn.pr.on, .sbtn.pr.on::after { animation: none; }
}

/* ======================================================================
   v2 · three roles, one plan: role strip, role lens, cabinet window
   ====================================================================== */
:root { --r-retailer: #2a5c93; --r-supplier: #1e6b4f; --r-agriva: var(--accent); --roles-h: 54px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --r-retailer: #5b93d6; --r-supplier: #3fae7f; } }
:root[data-theme="dark"] { --r-retailer: #5b93d6; --r-supplier: #3fae7f; }

/* whose screen is open: three roles, the active one filled with its colour */
.roles {
  position: fixed; z-index: 5; top: 66px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px; padding: 5px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow-card); max-width: calc(100% - 24px);
}
.roles button {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px;
  border: 0; border-radius: 999px; background: none; color: var(--muted);
  font: 600 13.5px/1 var(--font-body); cursor: pointer; white-space: nowrap;
  transition: background 0.35s, color 0.35s;
}
.roles button i { width: 9px; height: 9px; border-radius: 50%; background: var(--role); flex: none; transition: background 0.35s; }
.roles button:hover { color: var(--ink); background: color-mix(in srgb, var(--role) 12%, transparent); }
.roles button.on { background: var(--role); color: #fff; }
.roles button.on i { background: #fff; }
.roles button.on[data-role="agriva"] { color: var(--on-accent); }
.roles button.on[data-role="agriva"] i { background: var(--on-accent); }
.roles.all button { color: var(--ink); }
.rarr { color: var(--muted); font-size: 12px; }

/* a short caption instead of the long card */
.stage { top: calc(var(--header) + var(--roles-h)); }
.card { align-self: end; gap: 10px; padding: 18px 20px 16px; }
.card h1 { font-size: clamp(22px, 2vw, 29px); }
.card .lead { max-width: 36ch; }
.role-tag { display: flex; align-items: center; gap: 8px; margin: 0; font: 500 11.5px/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.role-tag i { width: 10px; height: 10px; border-radius: 50%; background: var(--role); flex: none; }
.role-tag b { color: var(--ink); font-weight: 600; }

/* the role lens: names the screen for a moment while the camera turns */
.lens {
  position: fixed; z-index: 4; left: 50%; top: 40%;
  display: grid; justify-items: center; gap: 6px; padding: 16px 28px 15px;
  background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--role); border-radius: 10px;
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); box-shadow: var(--shadow-card);
  opacity: 0; pointer-events: none; transform: translate(-50%, -50%);
}
.lens i { width: 12px; height: 12px; border-radius: 50%; background: var(--role); }
.lens b { font: 600 25px/1.1 var(--font-body); letter-spacing: -0.015em; white-space: nowrap; }
.lens span { font: 500 11.5px/1 var(--font-mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.lens.show { animation: lens 1.6s cubic-bezier(0.2, 0, 0, 1) both; }
@keyframes lens {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  72% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.02); }
}

/* the window is the role's cabinet: its colour on top, its sections as tabs */
.screen { border-top: 4px solid var(--rc, var(--line)); }
.screen[data-role="retailer"] { --rc: var(--r-retailer); }
.screen[data-role="supplier"] { --rc: var(--r-supplier); }
.screen[data-role="agriva"] { --rc: var(--accent); }
.screen[data-role="all"] { --rc: var(--line); }
.win-bar { background: color-mix(in srgb, var(--rc) 9%, var(--scr-card)); padding: 10px 14px; }
.who { background: none; padding: 0; font: 600 13px/1 var(--font-body); letter-spacing: 0; }
.who i { width: 10px; height: 10px; }
.demo-link { margin-left: auto; font: 500 11.5px/1 var(--font-mono); color: var(--muted); text-decoration: none; white-space: nowrap; }
.demo-link:hover { color: var(--ink); text-decoration: underline; }
.tabs { display: flex; gap: 2px; padding: 4px 8px 0; border-bottom: 1px solid var(--scr-line); background: var(--scr-card); overflow-x: auto; flex: none; }
.tabs[hidden] { display: none; }
.tabs button {
  padding: 9px 10px 10px; border: 0; border-bottom: 2px solid transparent; background: none;
  color: var(--muted); font: 500 12.5px/1 var(--font-body); cursor: pointer; white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-current] { color: var(--ink); border-bottom-color: var(--rc); font-weight: 600; }
.screen.flip { animation: flip 0.65s cubic-bezier(0.2, 0, 0, 1) both; transform-origin: right center; }
@keyframes flip { from { opacity: 0; transform: perspective(900px) rotateY(-32deg) translateX(40px); } to { opacity: 1; transform: none; } }

/* role cards on the first and last screens: each one opens that cabinet */
.rolecards { display: grid; gap: 8px; }
.rc {
  display: grid; grid-template-columns: 12px 1fr auto; align-items: center; column-gap: 10px; row-gap: 3px;
  text-align: left; padding: 12px 14px; background: var(--scr-card); color: var(--ink);
  border: 1px solid var(--scr-line); border-left: 4px solid var(--role); border-radius: 8px; cursor: pointer; font: inherit;
}
.rc[data-role="agriva"] { --role: var(--accent); }
.rc i { width: 10px; height: 10px; border-radius: 50%; background: var(--role); }
.rc b { font-size: 14px; }
.rc small { color: var(--muted); font: 500 11px/1 var(--font-mono); }
.rc span { grid-column: 2 / -1; color: var(--muted); font-size: 12.5px; }
.rc em { grid-column: 2 / -1; font: 600 12px/1 var(--font-body); font-style: normal; color: var(--ink); margin-top: 4px; }
.rc:hover { border-color: var(--role); }
.rc:hover em { text-decoration: underline; }

/* simpler product screens */
.form { grid-template-columns: 1fr; gap: 8px; }
.who-row { margin: 0 0 8px; }
.checks li { grid-template-columns: 20px 1fr; align-items: center; }
.team { padding: 10px 12px; border-radius: 8px; background: var(--scr-card); border: 1px solid var(--scr-line); }
.team .av { width: 28px; height: 28px; border-radius: 50%; background: var(--scr-btn); color: var(--scr-btn-ink); display: grid; place-items: center; font: 600 10px/1 var(--font-mono); flex: none; }
.team .tm { font-weight: 600; font-size: 13px; margin-right: auto; }
.terms.one { grid-template-columns: 1fr; }
.price b { font-size: 34px; }
.sum { margin-top: 10px; }

/* the timeline shows whose screen each step is */
.segs button i { background: color-mix(in srgb, var(--role, var(--ink)) 28%, transparent); }
.segs button[aria-current="step"] i::after { background: var(--role, var(--pass)); }
.segs button.done i::after { background: var(--role, var(--ink)); opacity: 0.75; }

.lbl.hide { opacity: 0; }
.lbl.dim { opacity: 0.85; }
.lbl b:empty { min-width: 12px; width: 12px; height: 12px; padding: 0; border-radius: 50%; margin-left: 2px; }

@media (max-width: 1000px) {
  :root { --roles-h: 44px; }
  .stage { top: auto; }
  .roles { top: 54px; padding: 4px; gap: 2px; }
  .roles button { padding: 8px 10px; font-size: 12px; gap: 6px; }
  .rarr { display: none; }
  .lens { top: 28%; padding: 12px 18px; }
  .status { top: 100px; }
  .lens b { font-size: 19px; }
  .card { padding: 14px 16px; }
}
@media (max-width: 420px) {
  .roles button { padding: 7px 8px; font-size: 11.5px; }
  .roles button i { display: none; }
  .demo-link { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .screen.flip, .lens.show { animation: none; }
}

/* ======================================================================
   v3 · narrated deal walkthrough: role plate, one window, quiet map
   ====================================================================== */
:root { --r-buyer: #2a5c93; --r-grower: #1e6b4f; --r-agriva: #b9cf2c; --r-all: var(--ink); --plate-h: 70px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --r-buyer: #5b93d6; --r-grower: #3fae7f; --r-agriva: #dceb6a; } }
:root[data-theme="dark"] { --r-buyer: #5b93d6; --r-grower: #3fae7f; --r-agriva: #dceb6a; }
.roles, .lens, .tabs, .tag { display: none !important; }

/* the plate: whose screen is on, large, in its colour */
.plate {
  position: fixed; z-index: 5; top: 62px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); box-shadow: var(--shadow-card);
}
.plate button {
  --rc: var(--r-buyer);
  display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  padding: 9px 14px; border: 0; border-radius: 11px; background: none; color: var(--muted); cursor: pointer; text-align: left;
  transition: background 0.4s, color 0.4s, padding 0.4s;
}
.plate button[data-role="agriva"] { --rc: var(--r-agriva); }
.plate button[data-role="grower"] { --rc: var(--r-grower); }
.plate svg { grid-row: span 2; width: 22px; height: 22px; fill: none; stroke: var(--rc); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: width 0.4s, height 0.4s; }
.plate .r { font: 700 13px/1 var(--font-body); letter-spacing: 0.06em; white-space: nowrap; }
.plate .o { white-space: nowrap; }
.plate .o { display: none; font: 500 11.5px/1.2 var(--font-body); opacity: 0.85; margin-top: 4px; }
.plate button:hover { color: var(--ink); }
.plate button.on { background: var(--rc); color: #fff; padding: 11px 22px 11px 16px; }
.plate button.on svg { stroke: currentColor; width: 30px; height: 30px; }
.plate button.on .r { font-size: 20px; letter-spacing: 0.04em; }
.plate button.on .o { display: block; }
.plate button.on[data-role="agriva"] { color: #173c2a; }
.plate.all button { color: var(--ink); }

/* layout: a heading on the left, the program window as the main thing on the right */
.stage { top: calc(var(--header) + var(--plate-h)); grid-template-columns: minmax(280px, 360px) minmax(0, 1fr) minmax(400px, 560px); }
.card { align-self: end; gap: 12px; padding: 20px 22px 20px; border-left: 5px solid var(--rc, var(--line)); }
.card[data-role="buyer"] { --rc: var(--r-buyer); }
.card[data-role="agriva"] { --rc: var(--r-agriva); }
.card[data-role="grower"] { --rc: var(--r-grower); }
.card[data-role="all"] { --rc: var(--accent); }
.count-tag { margin: 0; font: 500 11.5px/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.card h1 { font: 700 clamp(24px, 2.3vw, 34px)/1.12 var(--font-body); letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
.figure { margin: 0; font: 600 20px/1.2 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); padding-top: 10px; border-top: 1px solid var(--line); }
.figure[hidden] { display: none; }
.footnote { position: fixed; z-index: 4; left: max(24px, env(safe-area-inset-left)); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 4px); margin: 0; font: 500 11.5px/1.3 var(--font-mono); color: var(--muted); }

/* the window: framed in the role's colour, slides in from that role's side */
.screen { border: 2px solid var(--rc, var(--line)); border-top-width: 6px; border-radius: 12px; }
.screen[data-role="buyer"] { --rc: var(--r-buyer); }
.screen[data-role="agriva"] { --rc: var(--r-agriva); }
.screen[data-role="grower"] { --rc: var(--r-grower); }
.screen[data-role="all"] { --rc: var(--accent); }
.win-bar { background: color-mix(in srgb, var(--rc) 14%, var(--scr-card)); padding: 11px 16px; }
.who { font: 700 13px/1 var(--font-body); letter-spacing: 0.02em; }
.who i { background: var(--rc); width: 11px; height: 11px; }
.url { display: inline; }
.win-body { padding: 18px 20px 20px; font-size: 14px; }
.screen.in-buyer { animation: in-left 0.75s cubic-bezier(0.2, 0, 0, 1) both; }
.screen.in-grower { animation: in-right 0.75s cubic-bezier(0.2, 0, 0, 1) both; }
.screen.in-agriva { animation: in-top 0.75s cubic-bezier(0.2, 0, 0, 1) both; }
.screen.in-all { animation: card-in 0.6s cubic-bezier(0.2, 0, 0, 1) both; }
@keyframes in-left { from { opacity: 0; transform: translateX(-120px); } to { opacity: 1; transform: none; } }
@keyframes in-right { from { opacity: 0; transform: translateX(120px); } to { opacity: 1; transform: none; } }
@keyframes in-top { from { opacity: 0; transform: translateY(-70px); } to { opacity: 1; transform: none; } }

/* one change per screen is marked: it appears and pulses in the role's colour */
.chg { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--rc); background: color-mix(in srgb, var(--rc) 12%, var(--scr-card)); font-weight: 600; font-size: 13.5px; color: var(--ink); opacity: 0; transform: translateY(6px); transition: opacity 0.35s, transform 0.35s; }
.chg.on { opacity: 1; transform: none; }
.hl.on { animation: hl 1.3s ease-out 2; }
@keyframes hl { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--rc) 70%, transparent); } 100% { box-shadow: 0 0 0 12px color-mix(in srgb, var(--rc) 0%, transparent); } }
.hlp, .acc { opacity: 0; transition: opacity 0.3s; }
.hlp.on, .acc.on { opacity: 1; }
.pill.big { font-size: 12px; padding: 7px 12px; opacity: 0; }
.pill.big.on { opacity: 1; }
.s-h { font-size: 20px; }
.s-k { display: block; margin: 0 0 6px; }
.form { grid-template-columns: 1fr; gap: 8px; }
.inp.sel::after { content: "▾"; margin-left: auto; color: var(--muted); padding-left: 8px; }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rows li { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 10px; padding: 9px 12px; background: var(--scr-card); border: 1px solid var(--scr-line); border-radius: 8px; }
.rows li small { grid-column: 1; color: var(--muted); font-size: 12px; }
.rows li .pill { grid-row: 1 / span 2; grid-column: 2; }
.gcards { display: grid; gap: 8px; }
.gcard { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; padding: 12px 14px; background: var(--scr-card); border: 1px solid var(--scr-line); border-radius: 10px; }
.gcard > div { display: grid; gap: 2px; }
.gcard small { color: var(--muted); font-size: 12px; }
.gcard .vol { margin: 0; text-align: right; font-size: 12.5px; color: var(--muted); }
.gcard .vol b { font: 600 18px/1 var(--font-mono); color: var(--ink); }
.gcard .rec { grid-column: 1 / -1; margin: 0; font-size: 12.5px; color: var(--muted); }
.gcard .sbtn { justify-self: start; }
.gcard .acc { justify-self: end; }
.terms.one { grid-template-columns: 1fr; gap: 7px; }
.terms.one div { display: grid; grid-template-columns: 130px 1fr; gap: 10px; }
.sign { justify-content: flex-start; gap: 14px; flex-wrap: wrap; }
.badge { display: inline-block; margin: 0 0 10px; padding: 4px 9px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font: 600 11px/1 var(--font-mono); letter-spacing: 0.04em; }
.chart .fc.hit { fill: var(--warn); }
.tbl tr.hl td { background: color-mix(in srgb, var(--rc) 10%, transparent); }
.calc { display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--rc); background: color-mix(in srgb, var(--rc) 10%, var(--scr-card)); font: 500 12.5px/1.4 var(--font-mono); opacity: 0; transition: opacity 0.35s; }
.calc.on { opacity: 1; }
.calc b { font: 600 12px/1.2 var(--font-body); color: var(--muted); }
.chat .sbtn { justify-self: start; }
.chat-head .av { background: var(--accent); color: var(--on-accent); }
.tiles { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 16px; }
.tile { display: grid; justify-items: center; gap: 8px; padding: 16px 14px; width: 132px; text-align: center; border-radius: 12px; border: 2px solid var(--rc); background: color-mix(in srgb, var(--rc) 10%, var(--scr-card)); }
.tile i { width: 14px; height: 14px; border-radius: 50%; background: var(--rc); }
.tile b { font-size: 13.5px; line-height: 1.25; }
.tplus { color: var(--muted); font: 600 18px/1 var(--font-body); }
.s-foot.center { justify-content: center; }
.sbtn.big { padding: 13px 22px; font-size: 15px; }

/* player: replay · back · play · forward · timeline · sound */
.player .i-off { display: none; }
.player.muted .i-on { display: none; }
.player.muted .i-off { display: block; }
.player #mute[aria-pressed="true"] { color: var(--danger); }
.segs button { width: 34px; }
.segs button i { background: color-mix(in srgb, var(--rc) 30%, transparent); }
.segs button.done i::after { background: var(--rc); opacity: 0.8; }
.segs button[aria-current="step"] i::after { background: var(--rc); }
.count { display: none; }

/* phones: no 3D, a map of the three sides with the active one lit */
.scheme { display: none; }
@media (max-width: 760px) {
  :root { --plate-h: 54px; }
  #world, #labels, .status { display: none !important; }
  body { background: var(--sky); }
  .plate { top: 52px; width: calc(100% - 24px); justify-content: space-between; padding: 4px; border-radius: 12px; }
  .plate button { padding: 8px 10px; }
  .plate button .r { font-size: 11px; }
  .plate button:not(.on) .r { display: none; }
  .plate button.on { flex: 1; padding: 8px 12px; }
  .plate button.on .r { font-size: 15px; }
  .plate button.on svg { width: 24px; height: 24px; }
  .plate button.on .o { font-size: 11px; }
  .scheme { display: block; position: fixed; z-index: 3; top: 118px; left: 12px; right: 12px; height: 64px; }
  .scheme svg { width: 100%; height: 100%; }
  .scheme .link { stroke: var(--line); stroke-width: 2; stroke-dasharray: 4 4; fill: none; }
  .scheme .node circle { fill: var(--card); stroke: var(--line); stroke-width: 2; transition: fill 0.4s, stroke 0.4s; }
  .scheme .node path { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  .scheme .node[data-role="buyer"] { --rc: var(--r-buyer); }
  .scheme .node[data-role="agriva"] { --rc: var(--r-agriva); }
  .scheme .node[data-role="grower"] { --rc: var(--r-grower); }
  .scheme .node.on circle { fill: var(--rc); stroke: var(--rc); }
  .scheme .node.on path { stroke: #fff; }
  .scheme .node.on[data-role="agriva"] path { stroke: #173c2a; }
  .stage {
    top: 188px !important; bottom: calc(var(--bar) + 26px); height: auto; max-height: none;
    display: block; overflow-y: auto; padding: 0 12px 8px;
  }
  .card { padding: 12px 14px; gap: 6px; border-left-width: 4px; }
  .card h1 { font-size: 20px; }
  .figure { font-size: 16px; padding-top: 6px; }
  .screen { margin-top: 10px; }
  .win-body { padding: 14px; font-size: 13px; }
  .terms.one div { grid-template-columns: 110px 1fr; }
  .footnote { left: 0; right: 0; text-align: center; bottom: calc(var(--bar) + 4px); font-size: 10.5px; }
  .segs { gap: 2px; margin: 0 2px; flex-wrap: nowrap; }
  .segs button { width: 11px; }
  .player { gap: 2px; padding: 4px; }
  .player .pbtn { width: 32px; height: 32px; }
  .tile { width: 100px; padding: 12px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .screen.in-buyer, .screen.in-grower, .screen.in-agriva, .screen.in-all, .hl.on { animation: none; }
}

/* v4 — the Agriva side has one name, Agriva Admin Panel; role names read as tags in capitals everywhere */
.plate .r, .who .rn, .lbl.agriva, .scheme .cap { text-transform: uppercase; }
.plate .o:empty { display: none !important; }
.who b { font-weight: 700; }
/* the agreed chart: its legend sits under the columns, not on them */
.weeks + .key { margin-top: 10px; }
.scheme .cap { font: 700 9.5px/1 var(--font-body); letter-spacing: 0.03em; text-anchor: middle; fill: var(--muted); }
.scheme .node.on .cap { fill: var(--ink); }

@media (max-width: 760px) {
  .scheme { height: 80px; }
  .stage { top: 204px !important; }
  .plate button.on .r { font-size: 14px; letter-spacing: 0.02em; }
  /* the window header: the side's name in full, no address next to it */
  .url { display: none; }
  .who { white-space: normal; overflow: visible; line-height: 1.25; align-items: flex-start; }
  .who i { margin-top: 2px; }
  /* the last screen: three tiles one under another, so long words fit */
  .tiles { flex-direction: column; align-items: stretch; gap: 4px; margin: 0 0 12px; }
  .tile { width: auto; grid-auto-flow: column; justify-content: start; align-items: center; gap: 10px; padding: 11px 14px; text-align: left; }
  .tile b { font-size: 14px; }
  .tplus { align-self: center; font-size: 15px; }
  .s-foot.center { flex-wrap: wrap; }
}
@media (max-width: 760px) {
  .scheme { height: 86px; }
  .stage { top: 210px !important; }
  /* the last screen already has both buttons in the window */
  .card .actions:has(a) { display: none; }
}
