/* OLIVA demo: a restaurant menu with a cart that does the maths itself (delivery fee, pickup discount, gift) and a delivery tracker.
   Built to read as a native phone app: system font, tab bar, cards, bottom sheet. */
:root {
  --bg: #f7f3ea; --card: #fff; --ink: #1d1b16; --muted: #7d786c; --line: #e9e3d6;
  --acc: #4b5a2a; --acc-soft: #e9eedb; --hot: #d2452d; --hot-soft: #fbe6e0;
  --ease: cubic-bezier(.22, 1, .36, 1);
}
* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }
html { background: #e3ddd0; }
body { font: 400 16px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif; color: var(--ink); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; text-align: left; padding: 0; }
input, textarea { font: inherit; color: inherit; }
img { display: block; width: 100%; height: 100%; object-fit: cover; }
.app { position: relative; max-width: 430px; min-height: 100dvh; margin: 0 auto; background: var(--bg); overflow-x: hidden; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* fake system status bar: only inside the site's phone frame, a real phone already has one */
.sb { display: flex; justify-content: space-between; align-items: center; height: 44px; padding: 8px 26px 0; font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.sb i { display: flex; gap: 6px; align-items: center; }
.sb svg { height: 12px; width: auto; fill: currentColor; }
.home-ind { position: fixed; left: 50%; bottom: 7px; width: 134px; height: 5px; margin-left: -67px; border-radius: 3px; background: var(--ink); opacity: .85; z-index: 60; pointer-events: none; }

.screen { padding: 8px 18px 132px; animation: in .45s var(--ease) both; }
@keyframes in { from { opacity: 0; transform: translateY(12px); } }
h1 { font-size: 30px; letter-spacing: -.03em; line-height: 1.05; }
h2 { font-size: 22px; letter-spacing: -.02em; margin: 22px 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* header */
.top { display: flex; align-items: center; gap: 12px; padding: 6px 0 14px; }
.logo { width: 44px; height: 44px; border-radius: 14px; background: var(--acc); color: #fff; display: grid; place-items: center; font-weight: 800; letter-spacing: -.04em; flex: none; }
.top b { display: block; font-size: 20px; letter-spacing: -.02em; }
.top small { color: var(--muted); font-size: 13px; }

/* delivery / pickup switch */
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--line); border-radius: 14px; padding: 3px; margin-bottom: 12px; }
.seg button { text-align: center; padding: 9px 6px; border-radius: 11px; font-weight: 600; font-size: 15px; color: var(--muted); transition: background .25s var(--ease), color .25s; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* free-delivery progress */
.perk { background: var(--card); border-radius: 16px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.perk b { font-weight: 700; }
.bar { height: 6px; border-radius: 6px; background: var(--line); margin-top: 9px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 6px; background: var(--acc); transition: width .5s var(--ease); }
.perk.done { background: var(--acc-soft); color: var(--acc); }

/* categories */
.cats { display: flex; gap: 8px; overflow-x: auto; margin: 0 -18px 4px; padding: 2px 18px 10px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats button { flex: none; padding: 9px 15px; border-radius: 99px; background: var(--card); font-weight: 600; font-size: 15px; box-shadow: 0 1px 2px rgba(0,0,0,.05); transition: background .2s, color .2s; }
.cats button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* dish grid */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dish { background: var(--card); border-radius: 20px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.05); display: flex; flex-direction: column; }
.dish .ph { aspect-ratio: 4 / 3; background: var(--line); position: relative; display: block; width: 100%; }
.tag { position: absolute; left: 8px; top: 8px; background: var(--hot); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 4px 8px; border-radius: 99px; }
.dish .tx { padding: 10px 12px 4px; flex: 1; }
.dish .tx b { display: block; font-size: 15px; line-height: 1.2; letter-spacing: -.01em; }
.dish .tx small { color: var(--muted); font-size: 12px; }
.dish .ft { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px 10px 12px; min-height: 48px; }
.price { font-weight: 700; font-size: 16px; }
.add { width: 36px; height: 36px; border-radius: 12px; background: var(--acc-soft); color: var(--acc); display: grid; place-items: center; font-size: 22px; font-weight: 500; line-height: 1; transition: transform .15s var(--ease), background .2s; }
.add:active { transform: scale(.92); }
.step { display: flex; align-items: center; gap: 2px; background: var(--acc); color: #fff; border-radius: 12px; height: 36px; }
.step button { width: 32px; height: 36px; text-align: center; font-size: 20px; line-height: 1; }
.step span { min-width: 18px; text-align: center; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.step.light { background: var(--acc-soft); color: var(--acc); }

/* sticky cart bar */
.cartbar { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); width: min(394px, calc(100% - 36px)); z-index: 40; background: var(--acc); color: #fff; border-radius: 18px; padding: 13px 16px; display: flex; align-items: center; gap: 10px; font-weight: 700; box-shadow: 0 12px 30px rgba(75,90,42,.35); animation: up .4s var(--ease) both; }
@keyframes up { from { opacity: 0; transform: translate(-50%, 14px); } }
.cartbar .n { background: rgba(255,255,255,.2); border-radius: 9px; padding: 2px 9px; font-variant-numeric: tabular-nums; }
.cartbar .sum { margin-left: auto; font-variant-numeric: tabular-nums; }

/* tab bar */
.tabs { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: min(430px, 100%); z-index: 50; display: grid; grid-template-columns: repeat(3, 1fr); background: rgba(255,255,255,.92); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 8px 8px 22px; }
.tabs button { display: grid; justify-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 0; position: relative; }
.tabs button[aria-current="page"] { color: var(--acc); }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.badge { position: absolute; top: -2px; left: calc(50% + 6px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--hot); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 5px; }

/* cart */
.row { display: flex; gap: 12px; align-items: center; background: var(--card); border-radius: 18px; padding: 10px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.row .th { width: 64px; height: 64px; border-radius: 14px; overflow: hidden; flex: none; background: var(--line); }
.row .tx { flex: 1; min-width: 0; }
.row .tx b { display: block; font-size: 15px; line-height: 1.2; }
.row .tx small { color: var(--muted); font-size: 13px; }
.row.gift { background: var(--acc-soft); }
.row.gift .price { color: var(--acc); }
.sumbox { background: var(--card); border-radius: 18px; padding: 6px 16px; margin: 16px 0; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.line:last-child { border: 0; }
.line.total { font-size: 19px; font-weight: 700; }
.line .ok { color: var(--acc); font-weight: 600; }
.line span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hint { background: var(--hot-soft); color: #8f2d1c; border-radius: 14px; padding: 10px 14px; font-size: 14px; margin-bottom: 10px; }
.hint.good { background: var(--acc-soft); color: var(--acc); }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 20px; margin-bottom: 6px; }

.btn { display: block; width: 100%; text-align: center; background: var(--acc); color: #fff; font-weight: 700; font-size: 17px; padding: 16px; border-radius: 16px; transition: transform .15s var(--ease), opacity .2s; }
.btn:active { transform: scale(.98); }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); margin-top: 10px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; padding: 8px 0 12px; }

/* checkout form */
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field input, .field textarea { width: 100%; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 13px 14px; outline: none; transition: border-color .2s; }
.field input:focus, .field textarea:focus { border-color: var(--acc); }
.field.bad input { border-color: var(--hot); }
.field em { display: none; font-style: normal; color: var(--hot); font-size: 13px; margin-top: 4px; }
.field.bad em { display: block; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opts { display: grid; gap: 8px; margin-bottom: 14px; }
.opt { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; font-weight: 600; font-size: 15px; }
.opt[aria-pressed="true"] { border-color: var(--acc); background: var(--acc-soft); }
.opt i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: none; background: #fff; }
.opt[aria-pressed="true"] i { border: 6px solid var(--acc); }
.opt small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.place { display: flex; gap: 12px; align-items: center; background: var(--card); border-radius: 18px; padding: 10px; margin-bottom: 14px; }
.place .th { width: 72px; height: 72px; border-radius: 14px; overflow: hidden; flex: none; }

/* order tracker */
.done-ico { width: 64px; height: 64px; border-radius: 50%; background: var(--acc); color: #fff; display: grid; place-items: center; font-size: 32px; margin: 10px 0 16px; animation: pop .5s var(--ease) both; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.track { background: var(--card); border-radius: 20px; padding: 16px; margin: 16px 0; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.stage { display: grid; grid-template-columns: 24px 1fr; gap: 12px; padding-bottom: 16px; position: relative; color: var(--muted); }
.stage:last-child { padding-bottom: 0; }
.stage::before { content: ""; position: absolute; left: 11px; top: 22px; bottom: -2px; width: 2px; background: var(--line); }
.stage:last-child::before { display: none; }
.stage i { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); z-index: 1; display: grid; place-items: center; font-style: normal; font-size: 13px; color: #fff; transition: background .3s, border-color .3s; }
.stage.on { color: var(--ink); }
.stage.on i { background: var(--acc); border-color: var(--acc); }
.stage.on::before { background: var(--acc); }
.stage.now b::after { content: " · сейчас"; color: var(--acc); font-weight: 600; }
.stage b { display: block; font-size: 16px; }
.stage small { font-size: 13px; }
.demo-note { font-size: 13px; color: var(--muted); text-align: center; margin-top: 14px; }

/* bottom sheet with a dish */
.shade { position: fixed; inset: 0; z-index: 70; background: rgba(20,18,12,.45); animation: fade .3s both; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: min(430px, 100%); z-index: 71; background: var(--bg); border-radius: 26px 26px 0 0; overflow: hidden; animation: rise .45s var(--ease) both; max-height: 92dvh; overflow-y: auto; }
@keyframes rise { from { transform: translate(-50%, 100%); } }
.sheet .ph { aspect-ratio: 4 / 3; position: relative; }
.sheet .x { position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.92); display: grid; place-items: center; font-size: 18px; }
.sheet .in { padding: 16px 18px 26px; }
.sheet h3 { font-size: 24px; letter-spacing: -.02em; }
.sheet p { color: var(--muted); margin: 6px 0 14px; }
.sizes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.sizes button { text-align: center; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 4px; font-weight: 600; }
.sizes button small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
.sizes button[aria-pressed="true"] { border-color: var(--acc); background: var(--acc-soft); }
.sheet .ft { display: flex; gap: 12px; align-items: center; }
.sheet .ft .step { height: 54px; border-radius: 16px; }
.sheet .ft .step button { width: 42px; height: 54px; }
.sheet .ft .btn { flex: 1; }

.toast { position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); z-index: 80; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 99px; font-size: 14px; font-weight: 600; white-space: nowrap; animation: in .35s var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  .screen, .cartbar, .sheet, .shade, .toast, .done-ico { animation: none; }
  .bar i, .add, .btn { transition: none; }
}

/* entrance animations run only for new things (see render() in app.js) */
.app[data-screen="still"] .screen,
.app[data-sheet="still"] .sheet, .app[data-sheet="still"] .shade,
.app[data-bar="still"] .cartbar,
.app[data-toast="still"] .toast { animation: none; }
