/* UpLift demo — tokens mirror the merchant dashboard (src/lib/theme.ts).
   Three levels only:  1 the store + one caption   2 steps + scenarios
   3 settings / drawers (closed by default). */
:root {
  --ink: #102431; --secondary: #526674; --muted: #94A5B3;
  --hairline: #DCE3EA; --subtle: #EDF1F5; --app: #F6F8FA;
  --accent: #126EA8; --bright: #1687FF; --blue-50: #EFF7FC; --blue-100: #DBEDF8; --blue-200: #B8DAF0;
  --positive: #0F8A4F; --positive-soft: #E7F5ED;
  --negative: #B23A34; --negative-soft: #FBECEA;
  --signal: #F5A524;
  --tone: #3F7F3A;
  --font: 'IBM Plex Sans', 'Avenir Next', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(.22,.61,.36,1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font: 400 14px/1.5 var(--font); color: var(--ink); background: var(--app); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, select, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

/* ---------- header ---------- */
.top { height: 60px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 20px 0 14px; background: rgba(255,255,255,.9); backdrop-filter: blur(16px); border-bottom: 1px solid var(--hairline); position: relative; z-index: 30; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand img { width: 30px; height: 30px; border-radius: 50%; }
.brand b { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.brand-sub { font-size: 12px; font-weight: 600; color: var(--accent); background: var(--blue-50); border: 1px solid var(--blue-100); padding: 2px 8px; border-radius: 999px; }

.steps { display: flex; align-items: center; gap: 10px; list-style: none; }
.steps li:not(.line) { display: flex; align-items: center; gap: 9px; padding: 7px 14px 7px 8px; border-radius: 999px; transition: background .3s var(--ease), color .3s; color: var(--muted); }
.steps .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--subtle); transition: background .3s, color .3s; }
.steps .t { font-size: 15px; font-weight: 600; }
.steps li.active { background: var(--blue-50); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--blue-200); }
.steps li.active .n { background: var(--bright); color: #fff; }
.steps li.done { color: var(--ink); }
.steps li.done .n { background: var(--positive); color: #fff; }
.steps .line { width: 28px; height: 2px; background: var(--hairline); border-radius: 2px; }

.actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.seg { display: inline-flex; padding: 2px; border: 1px solid var(--hairline); border-radius: 10px; background: #fff; }
.seg button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--secondary); }
.seg button.on { background: var(--ink); color: #fff; }
.seg svg { width: 15px; height: 15px; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--hairline); background: #fff; color: var(--ink); }
.icon-btn:hover { border-color: var(--blue-200); }
.icon-btn svg { width: 17px; height: 17px; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 10px; border: 1px solid var(--hairline); background: #fff; font-size: 14px; font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #0F5A8A; }

/* ---------- stage ---------- */
.stage { position: relative; height: calc(100% - 60px); display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "narr canvas" "foot scen";
  background: radial-gradient(circle at 70% -20%, rgba(255,255,255,.95), transparent 45%), radial-gradient(circle at 90% 30%, rgba(91,193,255,.22), transparent 35%), linear-gradient(150deg, #EFF7FC 0%, #DBEDF8 55%, #C4E1F4 100%);
  transition: background .6s; }
/* Without Baysly: the backdrop keeps ~90% of its colour, the store ~75%. Felt, not announced. */
body.m-without .stage { background: radial-gradient(circle at 70% -20%, rgba(255,255,255,.95), transparent 45%), radial-gradient(circle at 90% 30%, rgba(120,190,235,.18), transparent 35%), linear-gradient(150deg, #EFF6FA 0%, #DCEBF5 55%, #C8DFEE 100%); }

/* narration */
.narr { grid-area: narr; padding: 34px 28px 20px 32px; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.scene { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--secondary); min-height: 18px; }
.actor { display: inline-flex; align-self: flex-start; align-items: center; gap: 8px; margin-top: 18px; padding: 6px 12px 6px 8px; border-radius: 999px; font-size: 13px; font-weight: 700; background: #fff; box-shadow: 0 1px 2px rgba(16,36,49,.08), 0 0 0 1px var(--hairline); transition: background .3s, color .3s; min-height: 32px; }
.actor:empty { visibility: hidden; }
.actor i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; }
.actor.shopper i { background: #FFF1DA; color: #A0600A; }
.actor.baysly { background: var(--bright); color: #fff; box-shadow: 0 8px 24px -6px rgba(22,135,255,.6); }
.actor.baysly i { background: rgba(255,255,255,.2); color: #fff; }
.actor.without { background: #5B6670; color: #fff; }
.actor.without i { background: rgba(255,255,255,.2); color: #fff; }
.actor.result i { background: var(--positive-soft); color: var(--positive); }
.actor svg { width: 12px; height: 12px; }
.cap { margin-top: 14px; font-size: 30px; line-height: 1.16; font-weight: 700; letter-spacing: -.02em; min-height: 70px; }
.sub { margin-top: 10px; font-size: 16px; line-height: 1.5; color: var(--secondary); min-height: 48px; }
.sub:empty { min-height: 0; margin-top: 0; }
.fade-in { animation: fadeUp .45s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.panel { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.card:empty { display: none; }
.card { background: #fff; border-radius: 16px; border: 1px solid rgba(220,227,234,.9); box-shadow: 0 1px 2px rgba(16,36,49,.05), 0 16px 40px -24px rgba(16,36,49,.35); padding: 16px 18px; }
.sig { display: flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 500; padding: 6px 0; }
.sig i { width: 10px; height: 10px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 4px rgba(245,165,36,.2); flex: none; }
.arch { display: flex; align-items: center; gap: 12px; }
.arch .dot { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--tone) 14%, #fff); color: var(--tone); flex: none; }
.arch .dot svg { width: 20px; height: 20px; }
.arch .k { font-size: 12px; color: var(--secondary); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.arch .v { font-size: 17px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.arch .m { margin-left: auto; font-size: 22px; font-weight: 700; color: var(--tone); font-variant-numeric: tabular-nums; }
.move { display: flex; gap: 12px; align-items: flex-start; }
.move .ic { width: 36px; height: 36px; border-radius: 10px; background: var(--bright); color: #fff; display: grid; place-items: center; flex: none; }
.move .k { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.move .v { font-size: 16px; font-weight: 600; line-height: 1.35; }
.outcome { display: grid; gap: 8px; }
.oc { display: grid; grid-template-columns: 28px 1fr; gap: 2px 10px; align-items: center; padding: 12px 14px; border-radius: 14px; }
.oc .ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; grid-row: span 2; font-weight: 700; }
.oc .k { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.oc .v { font-size: 15.5px; font-weight: 600; }
.oc.no { background: #F1F3F5; color: #5B6670; }
.oc.no .ic { background: #DDE2E7; color: #5B6670; }
.oc.yes { background: var(--positive-soft); color: #0B6B3D; box-shadow: inset 0 0 0 1.5px rgba(15,138,79,.25); }
.oc.yes .ic { background: var(--positive); color: #fff; }
.lift { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 4px 4px 0; }
.lift b { font-size: 34px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.lift span { flex: 1 1 150px; font-size: 13.5px; color: var(--secondary); line-height: 1.35; }
.money { margin-top: 8px; padding: 9px 12px; border-radius: 10px; background: var(--blue-50); font-size: 13.5px; color: var(--secondary); }
.money b { color: var(--accent); font-size: 15px; }
.tally { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 1.4; color: var(--secondary); max-width: 320px; min-height: 36px; }
.tally:empty { visibility: hidden; }   /* reserved, so the stage never jumps when it fills */
.tally i { width: 8px; height: 8px; border-radius: 50%; background: var(--positive); box-shadow: 0 0 0 4px rgba(15,138,79,.15); flex: none; }
.tally b { color: var(--ink); }
.tally.pop { animation: fadeUp .5s var(--ease) both; }
.next { margin-top: 20px; display: flex; align-items: center; gap: 12px; opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity .35s var(--ease), transform .35s var(--ease); }
.next.show { opacity: 1; transform: none; pointer-events: auto; }
@media (min-width: 901px) { .narr > .next { position: sticky; bottom: 0; z-index: 2; } }
.next-btn { display: inline-flex; align-items: center; gap: 9px; padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 15px; font-weight: 600; box-shadow: 0 10px 26px -10px rgba(16,36,49,.55); transition: transform .15s, background .2s; }
.next-btn:hover { background: #1B3A4E; transform: translateX(2px); }
.next-btn svg { width: 15px; height: 15px; }
.next.show .next-btn svg { animation: nudgeR 2.4s ease-in-out 1.2s infinite; }
@keyframes nudgeR { 0%, 100% { transform: none; } 50% { transform: translateX(3px); } }
.back-btn { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--hairline); background: #fff; color: var(--ink); cursor: pointer; transition: transform .15s, opacity .2s, border-color .2s; }
.back-btn:hover { border-color: var(--blue-200); transform: translateX(-2px); }
.back-btn:disabled { opacity: .35; cursor: default; transform: none; }
.back-btn svg { width: 16px; height: 16px; }
.next { gap: 10px; flex-wrap: wrap; }
.next-btn { white-space: nowrap; }
.next-hint { white-space: nowrap; flex-basis: 100%; }
.rewind { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(236,245,251,.82); backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .18s; }
body.rewinding .narr > * { opacity: 0; transition: none; }
.narr > *:not(.next) { transition: opacity .25s; }
.rewind.on { opacity: 1; pointer-events: auto; }
.rewind span { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(16,36,49,.3); }
.rewind span svg { width: 15px; height: 15px; animation: spinBack 1s linear infinite; }
@keyframes spinBack { to { transform: rotate(-360deg); } }
.next-hint { font-size: 12.5px; color: var(--muted); }
.next-hint kbd { font: 600 11px var(--mono); padding: 2px 6px; border-radius: 5px; background: #fff; box-shadow: inset 0 0 0 1px var(--hairline); color: var(--secondary); }
.scanlist { display: flex; flex-wrap: wrap; gap: 6px; }
.scanlist span { font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: #fff; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--blue-200); animation: fadeUp .3s var(--ease) both; }
.bigcount { font-size: 44px; font-weight: 700; letter-spacing: -.03em; color: var(--accent); line-height: 1; }
.bigcount small { font-size: 15px; font-weight: 600; color: var(--secondary); letter-spacing: 0; margin-left: 6px; }

/* canvas + device */
.canvas { grid-area: canvas; position: relative; min-width: 0; min-height: 0; margin: 22px 24px 8px 4px; }
.device-wrap { position: absolute; inset: 0; }
.device { position: absolute; left: 50%; top: 50%; transform-origin: center center; transition: box-shadow .5s var(--ease), filter .6s; }
.device.desktop { width: 1280px; height: 800px; border-radius: 14px; background: #fff; box-shadow: 0 0 0 1px rgba(16,36,49,.08), 0 30px 70px -30px rgba(16,36,49,.4); display: flex; flex-direction: column; }
.device.desktop .inner { flex: 1; min-height: 0; display: flex; flex-direction: column; border-radius: 0 0 14px 14px; overflow: hidden; }
.chrome { height: 40px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 16px; border-bottom: 1px solid var(--subtle); border-radius: 14px 14px 0 0; background: #fff; }
.chrome .dots { display: flex; gap: 7px; width: 80px; }
.chrome .dots i { width: 12px; height: 12px; border-radius: 50%; display: block; background: #E3E7EB; }
.chrome-gap { width: 80px; }
.url { flex: 1; max-width: 520px; margin: 0 auto; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 6px 14px; border-radius: 999px; background: var(--subtle); font-size: 13px; color: var(--secondary); }
.url svg { width: 12px; height: 12px; }
.url b { color: var(--ink); font-weight: 500; }
.screen-clip { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #fff; }
.screen { position: absolute; inset: 0; transition: transform .9s cubic-bezier(.4,0,.2,1); }
.screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }

.device.mobile { width: 418px; height: 872px; border-radius: 58px; background: #0E1B24; padding: 14px; box-shadow: 0 0 0 2px #2A3945 inset, 0 40px 90px -30px rgba(16,36,49,.55); }
.device.mobile .inner { position: relative; width: 390px; height: 844px; border-radius: 46px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.status { height: 50px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 4px 34px 0 38px; font-size: 15px; font-weight: 600; position: relative; background: #fff; }
.status .notch { position: absolute; left: 50%; top: 11px; transform: translateX(-50%); width: 122px; height: 34px; border-radius: 20px; background: #0b0b0c; }
.status .bat { width: 25px; height: 12px; border-radius: 4px; border: 1.6px solid #141416; position: relative; }
.status .bat::after { content: ''; position: absolute; inset: 1.5px 6px 1.5px 1.5px; background: #141416; border-radius: 2px; }
.url-m { height: 36px; flex: none; margin: 0 14px 6px; border-radius: 11px; background: var(--subtle); display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; color: var(--secondary); }
.url-m svg { width: 11px; height: 11px; }
.home-ind { position: absolute; left: 50%; bottom: 9px; transform: translateX(-50%); width: 136px; height: 5px; border-radius: 3px; background: rgba(16,36,49,.85); z-index: 7; }

/* mode: who is acting */
.mode-chip { position: absolute; left: 50%; top: -18px; transform: translate(-50%, -100%); z-index: 9; display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; font-size: 15px; font-weight: 700; white-space: nowrap; background: #fff; color: var(--ink); box-shadow: 0 8px 24px -8px rgba(16,36,49,.3); transition: background .35s, color .35s, opacity .3s; }
.mode-chip:empty { opacity: 0; }
.mode-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 4px rgba(245,165,36,.22); }
.mode-chip svg { width: 15px; height: 15px; }
body.m-baysly .mode-chip { background: var(--bright); color: #fff; box-shadow: 0 10px 30px -6px rgba(22,135,255,.7); }
body.m-without .mode-chip { background: #5B6670; color: #fff; }
body.m-done .mode-chip { background: var(--positive); color: #fff; }
body.m-baysly .device.desktop { box-shadow: 0 0 0 4px var(--bright), 0 0 80px 10px rgba(22,135,255,.35), 0 30px 70px -30px rgba(16,36,49,.4); }
body.m-baysly .device.mobile { box-shadow: 0 0 0 2px #2A3945 inset, 0 0 0 5px var(--bright), 0 0 80px 10px rgba(22,135,255,.4); }
body.m-without .screen iframe { filter: saturate(.75); transition: filter .6s; }

/* Foveated focus: a faint haze outside a soft window at the shopper's pointer.
   A plain gradient, not backdrop-filter + mask: that pairing is unreliable
   across browsers and GPUs (some drop the mask and blur everything). */
.fovea { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; transition: opacity 1s var(--ease);
  --fx: 50%; --fy: 40%; --fr: 240px; --ff: 300px;
  background: radial-gradient(circle at var(--fx) var(--fy),
    rgba(246,249,252,0) 0, rgba(246,249,252,0) var(--fr),
    rgba(246,249,252,.14) calc(var(--fr) + var(--ff) * .55),
    rgba(246,249,252,.24) calc(var(--fr) + var(--ff))); }
.fovea.on { opacity: 1; }
.device.mobile .fovea { --ff: 190px; }
.shield { position: absolute; inset: 0; z-index: 4; display: none; }
.shield.on { display: block; }
.away { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(16,36,49,.6); backdrop-filter: blur(4px) grayscale(.7); opacity: 0; pointer-events: none; transition: opacity .35s; }
.away.on { opacity: 1; }
.away > div { background: #fff; border-radius: 18px; padding: 22px 28px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.35); display: grid; justify-items: center; gap: 4px; }
.away svg { width: 34px; height: 34px; color: var(--secondary); margin-bottom: 6px; }
.away b { font-size: 20px; }
.away span { font-size: 15px; color: var(--secondary); }
.ended { position: absolute; left: 50%; top: 22px; transform: translate(-50%, -10px); z-index: 6; opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none; background: #3D4851; color: #fff; border-radius: 999px; padding: 11px 20px; font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 9px; white-space: nowrap; box-shadow: 0 12px 34px rgba(16,36,49,.35); }
.ended.on { opacity: 1; transform: translate(-50%, 0); }
.ended i { width: 10px; height: 10px; border-radius: 50%; background: #F08A84; }

/* scenarios */
.scenarios { grid-area: scen; display: flex; justify-content: center; align-items: flex-end; align-content: flex-end; gap: 8px; padding: 6px 24px 18px 4px; flex-wrap: wrap; }
.scn { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--secondary); background: rgba(255,255,255,.55); overflow: hidden; transition: background .25s, color .25s, box-shadow .25s; }
.scn:hover { background: rgba(255,255,255,.85); color: var(--ink); }
.scn .d { width: 9px; height: 9px; border-radius: 50%; background: var(--g); }
.scn.on { background: #fff; color: var(--ink); box-shadow: 0 6px 20px -8px rgba(16,36,49,.3), inset 0 0 0 1.5px var(--g); }
.scn .bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--g); }
.scn.done .d { background: var(--positive); }
.foot { grid-area: foot; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; padding: 6px 28px 18px 32px; min-width: 0; }
.links { display: flex; gap: 16px; align-items: center; }
.links button { font-size: 13.5px; font-weight: 600; color: var(--accent); display: inline-flex; gap: 6px; align-items: center; }
.links button:hover { text-decoration: underline; }

/* ---------- opening ---------- */
.intro { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: rgba(236,245,251,.72); backdrop-filter: blur(14px) saturate(1.1); transition: opacity .6s var(--ease), visibility .6s; }
.intro.gone { opacity: 0; visibility: hidden; }
.intro-card { max-width: 720px; text-align: center; animation: fadeUp .7s var(--ease) both; }
.intro-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); background: #fff; padding: 7px 14px; border-radius: 999px; box-shadow: inset 0 0 0 1.5px var(--blue-200); }
.intro-eyebrow i { width: 8px; height: 8px; border-radius: 50%; background: var(--positive); box-shadow: 0 0 0 4px rgba(15,138,79,.2); }
.intro h2 { margin-top: 22px; font-size: 50px; line-height: 1.06; font-weight: 700; letter-spacing: -.035em; }
.intro h2 em { font-style: normal; color: var(--accent); }
.intro p { margin: 18px auto 0; max-width: 560px; font-size: 18px; line-height: 1.55; color: var(--secondary); }
.intro-pillars { display: flex; justify-content: center; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
.intro-pillars span { display: inline-flex; align-items: center; gap: 9px; padding: 9px 15px 9px 9px; border-radius: 999px; background: #fff; font-size: 15px; font-weight: 600; box-shadow: 0 6px 18px -10px rgba(16,36,49,.35); }
.intro-pillars i { width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #fff; font-style: normal; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.intro .btn:disabled { opacity: .7; cursor: progress; box-shadow: none; }
.intro .btn { margin-top: 30px; padding: 13px 22px; font-size: 16px; border-radius: 12px; box-shadow: 0 12px 30px -10px rgba(18,110,168,.6); }

/* ---------- settings modal ---------- */
.modal { margin: auto; border: 0; border-radius: 18px; padding: 24px; width: min(460px, calc(100% - 32px)); box-shadow: 0 30px 80px rgba(16,36,49,.35); color: var(--ink); }
.modal::backdrop { background: rgba(16,36,49,.35); backdrop-filter: blur(3px); }
.modal h3 { font-size: 18px; margin-bottom: 14px; }
.modal .row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--subtle); font-size: 14px; }
.modal select, .modal input:not([type]) { border: 1px solid var(--hairline); border-radius: 8px; padding: 6px 10px; background: #fff; font-size: 13.5px; max-width: 180px; }
.modal input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.hint { font-size: 12.5px; color: var(--secondary); margin-top: 10px; }
.hint code { font: 12px var(--mono); background: var(--subtle); padding: 1px 5px; border-radius: 4px; }
.modal-foot { display: flex; justify-content: space-between; margin-top: 18px; }

/* ---------- drawer ---------- */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100%); z-index: 40; background: #fff; box-shadow: -20px 0 60px rgba(16,36,49,.18); transform: translateX(105%); transition: transform .35s var(--ease); display: flex; flex-direction: column; }
.drawer.on { transform: none; }
.scrim { position: fixed; inset: 0; z-index: 39; background: rgba(16,36,49,.25); opacity: 0; pointer-events: none; transition: opacity .3s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--subtle); }
.tabs { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--subtle); }
.tabs button { padding: 7px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--secondary); }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(16,36,49,.12); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px; }
.pane { display: none; }
.pane.on { display: block; }
.pane h4 { font-size: 13px; font-weight: 700; margin: 20px 0 8px; }
.pane h4:first-child { margin-top: 0; }
.pane p { font-size: 13px; color: var(--secondary); }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { border: 1px solid var(--subtle); border-radius: 12px; padding: 12px; }
.kpi b { display: block; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--secondary); }
.kpi.accent b { color: var(--accent); }
.gtable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.gtable td { padding: 8px 4px; border-bottom: 1px solid var(--subtle); }
.gtable td:last-child { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.gtable i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; }
.maprow { display: grid; grid-template-columns: 16px 1fr auto; gap: 1px 8px; padding: 7px 0; border-bottom: 1px solid var(--subtle); font-size: 13px; }
.maprow .ok { color: var(--positive); font-weight: 700; }
.maprow .no { color: var(--muted); }
.maprow code { grid-column: 2 / 4; font: 11px var(--mono); color: var(--secondary); overflow-wrap: anywhere; }
.maprow .src { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.maprow .src.store { color: #B7790D; }
.log { font: 11.5px/1.6 var(--mono); color: var(--secondary); }
.log div { display: grid; grid-template-columns: 44px 1fr; gap: 8px; }
.log .t { color: var(--muted); }
.proof { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--positive-soft); color: #0B6B3D; font-size: 13px; font-weight: 600; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 60; max-width: calc(100% - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- smaller screens ---------- */
@media (max-width: 1180px) {
  .stage { grid-template-columns: minmax(270px, 320px) minmax(0, 1fr); }
  .cap { font-size: 25px; }
  .seg span { display: none; }
  .scenarios { gap: 6px; }
  .scn { padding: 8px 12px; font-size: 13px; }
  .foot { padding-left: 28px; }
  /* narrower column: a long "Next shopper: …" label wraps inside the button, never under Back */
  .next { flex-wrap: nowrap; }
  .next-btn { flex: 0 1 auto; min-width: 0; white-space: normal; text-align: left; line-height: 1.25; }
  .next-hint { display: none; }
}
/* Short laptop screens (≈720–860px tall): tighten the narration so the
   outcome card and the Next button fit without scrolling the column. */
@media (min-width: 901px) and (max-height: 860px) {
  .narr { padding-top: 22px; }
  .actor { margin-top: 12px; }
  .cap { font-size: 24px; min-height: 56px; margin-top: 10px; }
  .sub { font-size: 15px; min-height: 0; margin-top: 6px; }
  .panel { margin-top: 14px; gap: 8px; }
  .card { padding: 12px 14px; }
  .oc { padding: 9px 12px; }
  .oc .v { font-size: 14.5px; }
  .lift b { font-size: 28px; }
  .money { margin-top: 6px; padding: 7px 10px; }
  .sig { padding: 4px 0; font-size: 14px; }
  .next { margin-top: 12px; }
  .next-hint { display: none; }
  .next-btn { padding: 11px 16px; }
  .back-btn { width: 44px; height: 44px; }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  .top { grid-template-columns: 1fr auto; gap: 8px; height: auto; padding: 12px 14px 10px; }
  .steps { grid-column: 1 / -1; grid-row: 2; justify-content: center; gap: 4px; }
  .steps .t { font-size: 13px; }
  .steps li:not(.line) { padding: 5px 8px 5px 5px; gap: 6px; }
  .steps .n { width: 22px; height: 22px; font-size: 11.5px; }
  .steps .line { width: 8px; }
  .stage { height: auto; min-height: calc(100% - 60px); display: flex; flex-direction: column; }
  .narr { padding: 18px 18px 6px; overflow: visible; }
  .cap { font-size: 22px; min-height: 0; margin-top: 10px; }
  .sub { font-size: 14.5px; min-height: 0; }
  .actor { margin-top: 10px; }
  .panel { margin-top: 12px; }
  .next { margin-top: 14px; }
  .next-hint { display: none; }
  .canvas { height: 70vh; min-height: 520px; margin: 26px 12px 8px; }
  .scenarios { padding: 6px 12px; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .scenarios::-webkit-scrollbar { display: none; }
  .scn { flex: none; }
  .foot { padding: 6px 18px 18px; }
  .tally:empty { display: none; }
  .intro h2 { font-size: 34px; }
  .intro p { font-size: 16px; }
}
@media (max-width: 560px) {
  .brand b, .brand-sub { display: none; }
  .steps .t { font-size: 12px; }
  .steps .n { display: none; }
  .steps li:not(.line) { padding: 5px 8px; }
  .actions .seg { display: none; }
  .intro h2 { font-size: 29px; }
  .intro-pillars span { font-size: 13.5px; }
}
/* ---------- phone: the store on top at full width, the story in a sheet below ---------- */
@media (max-width: 640px) {
  html, body { height: 100%; overflow: hidden; }
  .top { padding: 12px 14px 8px; row-gap: 6px; }
  .stage { height: calc(100dvh - var(--top-h, 96px)); min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto auto; grid-template-areas: "canvas" "scen" "narr"; }
  .canvas { height: auto; min-height: 0; margin: 8px 10px 4px; }
  .device.mobile { width: 390px; padding: 0; border-radius: 16px; background: #fff; box-shadow: 0 0 0 1px rgba(16,36,49,.08), 0 14px 34px -14px rgba(16,36,49,.4); }
  .device.mobile .inner { height: 100%; border-radius: 16px; }
  #statusBar, #homeInd { display: none; }
  .url-m { margin: 6px 10px; height: 30px; font-size: 12px; }
  .mode-chip, .device.mobile .mode-chip { top: 44px; transform: translate(-50%, 0); font-size: 12.5px; padding: 6px 12px; box-shadow: 0 6px 18px -6px rgba(16,36,49,.35); }
  .scenarios { padding: 4px 10px 8px; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .scn { flex: none; padding: 6px 12px; font-size: 13px; }
  .foot { display: none; }
  .narr { grid-area: narr; background: #fff; border-radius: 20px 20px 0 0; box-shadow: 0 -12px 34px -14px rgba(16,36,49,.3);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); max-height: 44dvh; overflow-y: auto; }
  .scene { display: none; }
  .actor { margin-top: 0; font-size: 12px; min-height: 26px; padding: 4px 10px 4px 6px; }
  .cap { font-size: 19px; margin-top: 8px; min-height: 0; }
  .sub { font-size: 13.5px; margin-top: 4px; min-height: 0; }
  .panel { margin-top: 10px; }
  .panel .card { display: none; }
  .panel .card:has(.outcome), .panel .card:has(.bigcount) { display: block; padding: 12px 14px; }
  .bigcount { font-size: 30px; }
  .lift b { font-size: 26px; }
  .oc { padding: 9px 12px; }
  /* The Next button stays in reach even when the outcome card is taller than the sheet. */
  .next { margin-top: 12px; position: sticky; bottom: calc(-12px - env(safe-area-inset-bottom)); padding: 10px 0 calc(12px + env(safe-area-inset-bottom)); background: #fff; box-shadow: 0 -10px 14px -8px #fff; z-index: 2; flex-wrap: nowrap; }
  .next:not(.show) { position: static; }
  .next-btn { flex: 1; justify-content: center; padding: 13px 18px; }
  .next-hint { display: none; }
  .intro { align-items: start; overflow-y: auto; padding: 22px 18px; }
  .intro h2 { font-size: 30px; margin-top: 16px; }
  .intro p { font-size: 15.5px; margin-top: 12px; }
  .intro-pillars { margin-top: 16px; gap: 6px; }
  .intro-pillars span { font-size: 13px; padding: 7px 12px 7px 7px; }
  .intro .btn { margin-top: 20px; width: 100%; justify-content: center; }
}
@media (max-width: 640px) and (max-height: 700px) {
  .intro-pillars { display: none; }
  .intro h2 { font-size: 27px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
