:root {
  --brand: #0E7C6B; --brand-dark: #0A5E51; --brand-soft: #E3F4F0; --bg: #F5F7F6; --card: #FFFFFF;
  --text: #121A19; --text2: #4E5C5A; --text3: #6B7876; --line: #E3E8E7; --save: #12804A; --save-soft: #E4F5EA;
  --warn: #8C5A00; --warn-soft: #FFF5DE; --err: #B3261E;
  --tm: #2E6DB4; --pe: #0F8C7E; --onemg: #C8572F; --nm: #4C7D3A;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: env(safe-area-inset-bottom); }
button, input, select { font: inherit; }
a { color: var(--brand-dark); }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--brand-dark); }
.brand img { border-radius: 7px; }
main { max-width: 640px; margin: 0 auto; padding: 12px 16px 96px; }
.pad { padding: 16px; }
.muted { color: var(--text2); }
.small { font-size: 13px; }
h1 { font-size: 22px; margin: 8px 0 4px; }
h2 { font-size: 17px; margin: 18px 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 10px 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--brand); background: var(--brand); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--card); color: var(--brand-dark); }
.btn.quiet { background: transparent; border-color: var(--line); color: var(--text); }
.btn:disabled { opacity: .5; cursor: default; }
.chip { min-height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; font-size: 14px; }
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); font-weight: 600; }
#installBtn { border-color: var(--brand); color: var(--brand-dark); font-weight: 600; }
.input { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); }
.input:focus { outline: 2px solid var(--brand); outline-offset: 0; }
.search { position: relative; }
.sugg { position: absolute; left: 0; right: 0; top: 52px; z-index: 4; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.08); max-height: 60vh; overflow: auto; }
.sugg button { display: block; width: 100%; text-align: left; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; color: var(--text); }
.sugg button:last-child { border-bottom: 0; }
.sub { color: var(--text3); font-size: 13px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .name { font-weight: 600; }
.step { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.step button { width: 38px; height: 36px; border: 0; background: var(--bg); font-size: 18px; cursor: pointer; color: var(--text); }
.step span { min-width: 34px; text-align: center; font-weight: 600; }
.x { border: 0; background: none; color: var(--text3); font-size: 22px; cursor: pointer; width: 36px; height: 36px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 8px; font-size: 12px; font-weight: 600; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.save { background: var(--save-soft); color: var(--save); }
.tag.rx { background: #EEF0FF; color: #3B3F8F; }
.note { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 8px 0; }
.ok { background: var(--save-soft); color: var(--save); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 8px 0; }
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--card); border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
.bar > div { max-width: 640px; margin: 0 auto; }
.dot { width: 24px; height: 24px; border-radius: 12px; color: #fff; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.total { font-size: 26px; font-weight: 800; }
.price { font-weight: 700; white-space: nowrap; }
.strike { text-decoration: line-through; color: var(--text3); font-weight: 400; font-size: 13px; }
.seg { display: flex; background: var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; min-height: 38px; border: 0; border-radius: 9px; background: none; cursor: pointer; color: var(--text2); font-weight: 600; }
.seg button.on { background: var(--card); color: var(--brand-dark); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.opt.sel { background: var(--brand-soft); margin: 0 -14px; padding: 10px 14px; }
details summary { cursor: pointer; color: var(--brand-dark); font-weight: 600; font-size: 14px; padding: 6px 0; }
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-card { background: var(--card); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet-card { border-radius: 18px; } }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 30; background: #1F2A28; color: #fff;
  padding: 10px 16px; border-radius: 10px; max-width: 90vw; font-size: 14px; }
.spin { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: r .8s linear infinite; display: inline-block; }
@keyframes r { to { transform: rotate(360deg); } }
.cardsel label { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
.cardsel input { width: 20px; height: 20px; accent-color: var(--brand); }
.vars { padding-left: 30px; }
.play { display: inline-flex; align-items: center; gap: 10px; background: #000; color: #fff; border-radius: 10px; padding: 8px 16px; text-decoration: none; font-weight: 600; }
.play svg { flex: none; }
ol.steps { padding-left: 22px; } ol.steps li { margin: 6px 0; }
.qr { width: 180px; height: 180px; background: #fff; padding: 6px; border-radius: 10px; border: 1px solid var(--line); }

/* ---------- iPhone install animation: a Safari mock, 5 steps, 10 s loop ---------- */
.ios-demo { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; justify-content: center; margin: 10px 0; }
.phone { position: relative; width: 190px; height: 360px; border-radius: 30px; border: 7px solid #1d1d1f; background: #fff; overflow: hidden; flex: none; }
.phone .page { position: absolute; inset: 0 0 46px; background: linear-gradient(#E3F4F0 0 44px, #fff 44px); }
.phone .page::before { content: "MedCart"; position: absolute; top: 14px; left: 14px; font-weight: 700; color: var(--brand-dark); font-size: 13px; }
.phone .page i { position: absolute; left: 14px; right: 14px; height: 10px; border-radius: 5px; background: #EDF0EF; }
.phone .tb { position: absolute; left: 0; right: 0; bottom: 0; height: 46px; background: #F2F2F7; border-top: 1px solid #ddd; display: flex; align-items: center; justify-content: space-around; color: #007AFF; font-size: 18px; }
.phone .tb .dots { position: relative; font-weight: 900; letter-spacing: 1px; }
.tap { position: absolute; width: 34px; height: 34px; border-radius: 50%; border: 3px solid #FF9500; opacity: 0; pointer-events: none; }
.menu { position: absolute; left: 8px; right: 8px; bottom: 52px; background: #fff; border-radius: 12px; box-shadow: 0 6px 22px rgba(0,0,0,.25);
  font-size: 11px; overflow: hidden; transform: translateY(130%); }
.menu div { padding: 7px 10px; border-bottom: 1px solid #eee; color: #111; }
.menu .hl { background: #FFF1DC; }
.share { position: absolute; left: 0; right: 0; bottom: 0; height: 250px; background: #F2F2F7; border-radius: 14px 14px 0 0; transform: translateY(105%);
  font-size: 11px; overflow: hidden; }
.share .h { padding: 8px 10px; font-weight: 700; border-bottom: 1px solid #ddd; background: #fff; }
.share .list { transform: translateY(0); }
.share .list div { padding: 8px 10px; background: #fff; border-bottom: 1px solid #eee; }
.share .list .a2hs { font-weight: 700; }
.addbar { position: absolute; inset: 0; background: #fff; transform: translateY(105%); font-size: 11px; }
.addbar .h { display: flex; justify-content: space-between; padding: 10px; border-bottom: 1px solid #ddd; font-weight: 700; }
.addbar .h b { color: #007AFF; }
.addbar .ic { margin: 18px auto 6px; width: 48px; height: 48px; border-radius: 11px; background: url(/icons/icon-192.png) center/cover; }
.addbar p { text-align: center; margin: 0; font-weight: 600; }
.home { position: absolute; inset: 0; background: linear-gradient(160deg, #3a6186, #89253e); opacity: 0; }
.home .ic { position: absolute; top: 40px; left: 22px; width: 40px; height: 40px; border-radius: 10px; background: url(/icons/icon-192.png) center/cover; }
.home span { position: absolute; top: 84px; left: 14px; width: 56px; text-align: center; color: #fff; font-size: 9px; }
.caps { padding-left: 22px; min-width: 200px; max-width: 320px; flex: 1; }
.caps li { margin: 6px 0; padding: 6px 8px; border-radius: 8px; color: var(--text2); }
.caps li b { color: var(--text); }
/* timeline: 0-18% tap •••, 18-36% menu + Share, 36-58% sheet scrolls to Add to Home Screen, 58-80% Add, 80-100% icon on home */
.anim .t1 { left: 140px; bottom: 6px; animation: t1 10s infinite; }
.anim .menu { animation: menu 10s infinite; }
.anim .t2 { left: 70px; bottom: 132px; animation: t2 10s infinite; }
.anim .share { animation: share 10s infinite; }
.anim .share .list { animation: scroll 10s infinite; }
.anim .t3 { left: 70px; bottom: 76px; animation: t3 10s infinite; }
.anim .addbar { animation: addbar 10s infinite; }
.anim .t4 { right: 2px; top: 2px; animation: t4 10s infinite; }
.anim .home { animation: home 10s infinite; }
.anim .c1 { animation: c1 10s infinite; } .anim .c2 { animation: c2 10s infinite; } .anim .c3 { animation: c3 10s infinite; }
.anim .c4 { animation: c4 10s infinite; } .anim .c5 { animation: c5 10s infinite; }
@keyframes t1 { 0%,4% { opacity: 0; transform: scale(1.6); } 8%,14% { opacity: 1; transform: scale(1); } 17%,100% { opacity: 0; } }
@keyframes menu { 0%,16% { transform: translateY(130%); } 20%,36% { transform: translateY(0); } 39%,100% { transform: translateY(130%); } }
@keyframes t2 { 0%,24% { opacity: 0; transform: scale(1.6); } 28%,34% { opacity: 1; transform: scale(1); } 37%,100% { opacity: 0; } }
@keyframes share { 0%,36% { transform: translateY(105%); } 40%,60% { transform: translateY(0); } 63%,100% { transform: translateY(105%); } }
@keyframes scroll { 0%,43% { transform: translateY(0); } 50%,100% { transform: translateY(-126px); } }
@keyframes t3 { 0%,51% { opacity: 0; transform: scale(1.6); } 54%,58% { opacity: 1; transform: scale(1); } 61%,100% { opacity: 0; } }
@keyframes addbar { 0%,59% { transform: translateY(105%); } 62%,80% { transform: translateY(0); } 83%,100% { transform: translateY(105%); } }
@keyframes t4 { 0%,68% { opacity: 0; transform: scale(1.6); } 72%,78% { opacity: 1; transform: scale(1); } 81%,100% { opacity: 0; } }
@keyframes home { 0%,81% { opacity: 0; } 84%,98% { opacity: 1; } 100% { opacity: 0; } }
@keyframes c1 { 0%,17% { background: var(--brand-soft); } 18%,100% { background: none; } }
@keyframes c2 { 0%,17% { background: none; } 18%,37% { background: var(--brand-soft); } 38%,100% { background: none; } }
@keyframes c3 { 0%,37% { background: none; } 38%,59% { background: var(--brand-soft); } 60%,100% { background: none; } }
@keyframes c4 { 0%,59% { background: none; } 60%,81% { background: var(--brand-soft); } 82%,100% { background: none; } }
@keyframes c5 { 0%,81% { background: none; } 82%,100% { background: var(--brand-soft); } }
@media (prefers-reduced-motion: reduce) { .anim * { animation-duration: 30s !important; } }
